Install R in Ubuntu 12.04 Precise Pangolin

January 10, 2013

(This article was first published on Hidden Treasures, and kindly contributed to R-bloggers)

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 E084DAB9. To add the key to your system with one command, open terminal (Ctrl+Alt+T) and use:

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

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


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)