By executing the below commands we can install R in ubuntu.
sudo apt-get --purge remove r-base
sudo apt-get --purge remove r-base-dev
This install the default version of R. If we want to install the latest version of R, we can follow as:
Uninstalling the previous version of R
sudo apt-get --purge remove r-base
sudo apt-get --purge remove r-base-dev
sudo apt-get --purge remove r-base-core
After that to install R:
sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -sc)/"
Then we will have to execute the below commands:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base
sudo apt-get --purge remove r-base
sudo apt-get --purge remove r-base-dev
This install the default version of R. If we want to install the latest version of R, we can follow as:
Uninstalling the previous version of R
sudo apt-get --purge remove r-base
sudo apt-get --purge remove r-base-dev
sudo apt-get --purge remove r-base-core
After that to install R:
sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -sc)/"
Then we will have to execute the below commands:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base