Installing R on Ubuntu

Since I needed to whip up a quick scatter plot, I decided to install my old friend R (http://cran.r-project.org/)

But as is usually the case a Google search only resulted in a partial instruction list, so here are the commands I used to get it all working.

sudo vi /etc/apt/sources.list

Add the following repository to the bottom of your sources list

deb http://cran.stat.ucla.edu/bin/linux/ubuntu jaunty/

Notice that this repository is for Jaunty aka Ubuntu 9.04, I used this for an older VMWare image that i had. If you have a newer version of Ubuntu simply replace “jaunty/” at the end with your versions name. (of course be sure to visit http://cran.stat.ucla.edu/bin/linux/ubuntu to make sure it is available)

Next we need to add the public key for this repository

gpg --keyserver subkeys.pgp.net --recv-key E2A11821
gpg -a --export E2A11821 | sudo apt-key add -

And finally update your repository to take in the changes

sudo apt-get update

Now that you have everything up to date you can go ahead and install R/CRAN with the following:

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

That should do it, post a comment if you have any issues.

One thought on “Installing R on Ubuntu

  1. cityvville says:

    You actually make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complex and very broad for me. I’m looking forward for your next post, I’ll try to get the hang of it!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>