Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Monday, 5 November 2012

Installing the latest version of R into Debian Stable

The R packages available in the Debian repository are are little out of date - to install the latest (stable) version we need to add a backports repository. Just follow the steps below!

Open the sources list with:
 sudo nano /etc/apt/sources.list  

Then add this line to the bottom of the file (use your favourite mirror if desired):
 deb http://cran.ma.imperial.ac.uk/bin/linux/debian squeeze-cran/  

The Debian backports are signed with the key of "Johannes Ranke (CRAN Debian archive) <jranke@uni-bremen.de>", with key ID 381BA480 . Import this using:
 sudo apt-key adv --keyserver subkeys.pgp.net --recv-key 381BA480  

Then, update the packages cache - this should complete without errors.
 sudo apt-get update  

Finally, install R and the R recommended packages using:
 sudo apt-get r-base r-recommended   

To check the version of R that is now installed, use:
 R --version  

To start R, simply type
 R  

at a command prompt. As usual, let me know of any issues or problems in the comments below.

Thursday, 27 September 2012

Problems with R and RGtk2

I ran across this issue while installing Rattle, a data mining library for the statistical programming language R, on to a Debian system. When installing the package RGtk2, seeing the below error means that your GTK version is not the version required by RGtk2.
 * installing *source* package ‘RGtk2’ ...  
 ** package ‘RGtk2’ successfully unpacked and MD5 sums checked  
 checking for pkg-config... /usr/bin/pkg-config  
 checking pkg-config is at least version 0.9.0... yes  
 checking for INTROSPECTION... no  
 checking for GTK... no  
 configure: error: GTK version 2.8.0 required  
 ERROR: configuration failed for package ‘RGtk2’  

The required version can be found in libgtk2.0-dev, so install this using your preferred package manager - for example using apt-get:
 sudo apt-get install libgtk2.0-dev    

Then reload R and:
 install.packages('RGtk2')  

Now, after the installation has finished, you should see:
 * DONE (RGtk2)  

As usual, let me know if it works for you in the comments below.

If you like this blog, and use R for statistical processing, you can help support my writing by purchasing a book from my bookstore. For both beginning and more advanced R users, I'd recommend Kenneth Knoblauch.

Thursday, 20 September 2012

Install the latest version of R in Ubuntu

The R version in the Ubuntu repositories is not the latest, so here's how to install R into Ubuntu 12.04:

Add the SSL key and import into apt:
 gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9  
 gpg -a --export E084DAB9 | sudo apt-key add -  

Add the repository to your sources list, by doing:
 sudo nano /etc/apt/sources.list  

Then add this line to the bottom of the sources file:
 deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu precise/  

Then, to install the latest version of R, do:
 sudo apt-get update  
 sudo apt-get install r-base  

Hit yes at the prompts, and voila, the latest version of R is installed!

Monday, 16 July 2012