Install R in Ubuntu 12.04 Precise Pangolin

[This article was first published on Hidden Treasures, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS.

One of my main motivations to install R is Sweave. The Sweave is a literate programming language which integrates LaTeX and R code. The main idea of the Sweave is to combine data analysis code and standard formatted text into a single document.


The Ubuntu CRAN (The Comprehensive R Archive Network) packages have been signed with a new pgp key. The Ubuntu archives on CRAN are signed with the key of “Michael Rutter” with key ID E298A3A825C0D65DFD57CBB651716619E084DAB9. To add the key to your system with one command, open terminal (Ctrl+Alt+T) and use:

$ sudo apt-key adv –keyserver –recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Open your sources.list file in gedit

$ sudo gedit /etc/apt/sources.list

and add the following line (using mirror) at the end of the file:

deb precise/

(You can go to for the list of CRAN mirrors and replace the current URL mirror with your favorite one)

To install the complete R system, use

$ sudo apt-get update

$ sudo apt-get install r-base

if you need to compile R packages from source, also install the r-base-dev package:

$ sudo apt-get install r-base-dev

That's all.

To leave a comment for the author, please follow the link and comment on their blog: Hidden Treasures. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)