1. Add R Repository to the sources list /etc/apt/sources.list:
Code: Select all
sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
Code: Select all
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E084DAB9
Code: Select all
gpg -a --export E084DAB9 | sudo apt-key add -
Code: Select all
sudo apt-get update
sudo apt-get install r-base r-base-dev
Code: Select all
sudo apt-get install gdebi-core
wget https://download1.rstudio.org/rstudio-0.99.896-amd64.deb
sudo gdebi -n rstudio-0.99.896-amd64.deb
rm rstudio-0.99.896-amd64.deb
To install R packages through Terminal, code
Code: Select all
install.packages("package_name")
Code: Select all
R
install.packages("swirl")
install.packages("deSolve")
Code: Select all
library("package_name")
Note:
If you need to install swirl package in Linux, first, install libcurl by running
Code: Select all
$ sudo apt-get install libcurl4-openssl-dev
You may get an error during swirl installation, the common one is
Code: Select all
installation of package ‘openssl’ had non-zero exit status
To solve the problem, install "libssl-dev" package through Synaptic Package Manager or run in the command line
Code: Select all
sudo apt-get install libssl-dev/unstable
To install courses in swirl, enter the following from the R console, substituting the name of the course by the actual course name that you wish to install:
Code: Select all
library(swirl)
install_from_swirl("Course Name Here")
swirl()
Code: Select all
install_from_swirl("R Programming")
Please note that course names are case sensitive!
For more information, including available courses go to https://github.com/swirldev/swirl_courses
Enjoy!