UBUNTU 16.04

Option 1:

sudo apt-get install -y r-base r-base-dev libcurl4-openssl-dev libssl-dev build-essential

Option 2:
with PPA. ref digitalocean

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 && \
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/' && \
sudo apt-get update && \
sudo apt-get install -y r-base r-base-dev libcurl4-openssl-dev libssl-dev build-essential && \
sudo -i R # install packages as root, so all users can use.

R-STUDIO

To install R-Studio, see: r-bloggers

DEFAULT MIRROR

To choose a mirror/package server:
Option 1: temp

chooseCRANmirror(graphics=FALSE, ind=1) # 1 = cloud

Option 2:

echo 'options(repos=structure(c(CRAN="https://cloud.r-project.org")))' >> ~/.Rprofile

Option 3:

vim /etc/R/Rprofile.site

uncomment and modify "local()":

local({r <- getOption("repos")
      r["CRAN"] <- "https://cloud.r-project.org"
      options(repos=r)})

ref

CHECK

install.packages(c('ggplot2'))
sessionInfo(package = NULL)
options(repr.plot.width=4, repr.plot.height=3)
t = c(1, 3, 6, 4, 9)
plot(t, col="blue")