Ubuntu – How to install/upgrade r-base to the latest version

rsoftware installation

I am pretty new to Linux. I installed R-base in my Ubuntu 12.04 using the Software Center (which by default is r-2.14). I want to upgrade to/install R 3.02 or newer. How can I do that? Thank you.

Best Answer

You need to add R's repository to your system:

  1. Use your favorite text editor (I'm using gedit as an example) to open /etc/apt/sources.list:

    sudo -H gedit /etc/apt/sources.list
    
  2. Add this line to the file (if this is slow, use another mirror. You may also want to change precise into the codename for your Ubuntu version --- e.g., trusty for 14.04):

     deb http://cran.rstudio.com/bin/linux/ubuntu precise/
    
  3. Update the list of packages

    sudo apt-get update
    
  4. Install the latest R-base (you can also use the software center again):

    sudo apt-get install r-base