Friday, February 20, 2015

How to install R and RStudio in LINUX within 10 steps?

-- automated system installation is a good practise to maintain folder structures properly

/usr/lib/R/library (core libs go here)
/usr/lib/R/site-library (user installed packages go here)

/etc/R/Renviron (environment variables go here)

-- automated installation keeps RStudio in MENU

-- to install normally through apt-get do the below(r-base is the core, r-base-dev is needed to use install.packages() inside R console)

$ sudo apt-get update
$ sudo apt-get install r-base r-base-dev

-- use 'R' command to check wheather the installation is done or not(this opens R console with version information w.r.t that ubuntu release)

$ R

-- to upgrade R to the current stable release
-- add the below line in /etc/apt/sources.list

deb http://ftp.iitm.ac.in/cran/bin/linux/ubuntu trusty

-- add the key as per the below command(key is must to upgrade R)

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9

-- update apt-get

$ sudo apt-get update

-- now upgrade only the particular packages of R using the below command

$ sudo apt-get install --only-upgrade r-base r-base-dev

-- now enter keyword 'R' in console to see the changes

$ R

-- to install RStudio, download the installer from the below URL, choose the appropriate one (linux type/version/32-64bit)

http://www.rstudio.com/products/rstudio/download/

-- you will get a .deb file, open it with package manager and click install

-- type for RStudio in MENU and click to start