Upgrading R
[This article was first published on R - datawookie, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This is the recipe I use to upgrade R on a Linux box. It’s something that I do fairly frequently on fresh EC2 instances.
Remove Old R
Check for existing R package.
dpkg -l | grep -E "(r-base-core|cran)"
Remove existing R installation.
sudo apt-get purge -y r-base-core
Check again for exsiting R packages: they should be gone.
Add Keys
Add keys.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
If you’re behind a firewall you can try something like this:
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key E084DAB9 gpg -a --export E084DAB9 | sudo apt-key add --
Add CRAN Repository
OSNAME=$(. /etc/os-release; echo "$ID") OSVERS=$(lsb_release -cs) sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/$OSNAME $OSVERS-cran40/"
Update the package list.
sudo apt-get -y update
Install New R
sudo apt-get -y install r-base
If you want to remove the packages installed in the process then you can do this:
sudo apt-get remove -y 'r-cran-.*'
Other Stuff
Install some system packages that are required for building various R packages.
sudo apt-get -y install \ htop \ libcurl4-openssl-dev \ libssl-dev \ libgeos-dev \ libgdal-dev \ libproj-dev \ libxml2-dev \ libudunits2-dev \ libsodium-dev \ pandoc \ openjdk-8-jdk \ openjdk-8-jre \ cargo \ libcairo2-dev \ libfreetype6-dev \ libclang-dev \ ttf-mscorefonts-installer \ fonts-roboto
Configuring Java
Where does R expect to find Java?
sudo R CMD javareconf
To leave a comment for the author, please follow the link and comment on their blog: R - datawookie.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.