installing R on Ubuntu 16.04 LTS

sudo nano /etc/apt/sources.list

add below line to sources.list (you should use any cran mirror site)

deb http://cran.nexr.com/bin/linux/ubuntu xenial/
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt update
sudo apt-get install r-base
sudo apt-get install r-base-dev