14 March 2012

Rcmdr on Ubuntu

On Windows, R comes with its own GUI, but on Ubuntu, GUIs such as Rcmdr have to be installed manually.

Software sources

Add a local CRAN mirror to Ubuntu, e.g. http://cran.stat.ucla.edu/, which corresponds to USA-California 2. Remember the mirror you add, because it will be the only one that will be allowed by Ubuntu to fetch software packages. Anyway, add /bin/linux/ubuntu/oneiric at the end of the URL (change oneiric for your ubuntu version). This should give the screenshot below:

Then execute:

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

Installing Rcmdr in R

sudo R

Then in the R command line:

install.packages("Rcmdr")

Then, finish the installation of Rcmdr by installing the missing dependencies:

library(Rcmdr)

A popup appears, select "CRAN mirror" (not "local folder"), click OK, and the console should start printing lines like below:

Loading required package: tcltk
Loading required package: car
Loading required package: MASS
Loading required package: nnet
Loading required package: survival
Loading required package: splines
also installing the dependency 'matrixcalc'

trying URL 'http://cran.stat.ucla.edu/src/contrib/matrixcalc_1.0-1.tar.gz'
Content type 'application/x-tar' length 8436 bytes
opened URL

...

The downloaded packages are in
 '/tmp/Rtmp6X20rs/downloaded_packages'

And the Rcmdr window should appear. To run Rcmdr in the future, type library(Rcmdr) in the R command prompt. Ctrl-A then Ctrl-R to run everything.

Encountered errors

'Rcmdr' is not available: An error like package 'Rcmdr' is not available (for r version 2.13.1) pops up if R was installed from the Ubuntu repository. The current version (as of March 2012) is 2.14.2. sudo apt-get update, then sudo apt-get install r-base r-base-dev should fix this. If you have the same error with not available (for r version 2.14.1), it may be that no CRAN mirror was added in the software sources to download Rcmdr from.

GPG error: The software center notifies you about new R updates from whichever mirror you picked. When sudo apt-get update, you get the following error:

W: GPG error: http://cran.stat.ucla.edu oneiric/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9

This article provides the solution:

gpg --keyserver keyserver.ubuntu.com --recv 51716619E084DAB9
gpg --export --armor 51716619E084DAB9 | sudo apt-key add -

Sources

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.