[R] installing R on Ubuntu

Dirk Eddelbuettel edd at debian.org
Sun Feb 8 20:52:37 CET 2009


Very nice!  Comments below.

On 7 February 2009 at 17:12, Paul Heinrich Dietrich wrote:
| I've read some of R's literature on Linux, including the R Admin manual, and
| didn't find it very useful, which is probably my own limitation.  But I did
| finally manage to get it working well.  I'm posting this to help others. 
| The following worked when installing R 2.8.1 on Ubuntu 8.04 Hardy Heron. 
| Here are truly step-by-step instructions for those who don't know Linux
| (like me):
| Installation and Initial Set-Up of R for Ubuntu Linux
| 1. Open the Bash terminal (Applications > Accessories > Terminal)
| 2. Type these lines to add the security key to access the latest version of
| the R Ubuntu package:
| 	user at computer:~$ gpg --keyserver subkeys.pgp.net --recv-key E2A11821
| 	user at computer:~$ gpg -a --export E2A11821 | sudo apt-key add -
| 3. Use the Bash terminal to open your sources.list file with gedit (text
| editor) for editing:
| 	user at computer:~$ sudo gedit /etc/apt/sources.list
| 4. Add this line to the bottom of the sources.list file:
| 	deb http://rh-mirror.linux.iastate.edu/CRAN/bin/linux/ubuntu hardy/
| 5. Save the file and go back to the Bash terminal.
| 6. Type this to update apt-get's database before you install R:
| 	user at computer:~$ sudo apt-get update
| 7. Install R with this command:
| 	user at computer:~$ sudo apt-get install r-base
| 8. Go to System > Administration > Synaptic Package Manager, and download
| the build-essential package.

In 7. you use apt, in 8. you use Synaptic. Why not to both at once:

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

as 'r-base-dev' depends on build-essential (and a few other things) and gets
you all this and more (see below).

| 9. To use R, simply enter R in the Bash terminal.  To quit, enter q().
| Additional programs will be needed to install other packages or work with
| other programs:
| 1. Install compilers for C++ and Fortran
| 	user at computer:~$ sudo apt-get install g++ gfortran
| 2. Install the developer versions of Blas and Lapack (what are these?)
| 	user at computer:~$ apt-get install libblas-dev liblapack-dev

The modified step 7 above would have done both for you.

| Updating Packages in R
| 1. Open the Bash terminal and start R with root permissions
| 	user at computer:~$ sudo R
| 2. Type > update.packages()

Yep. I also like 'sudo apt-get install littler' and I then copy or link
install.r to /usr/local/bin and just use

	  $ sudo install.r foo far fie foo

which would then install the (hyopthetical) packages foo, far, fie and foo
from CRAN.

| Installing the R Commander GUI
| 1. Open the Bash terminal and type:
|        user at computer:~$ apt-get install r-cran-rcmdr 
| Using the R Commander GUI
| library(Rcmdr)
| ...or once the library is open and Commander has been shut down, type:
| commander()
| Notes
| It looks like most of R has been put here:
| /etc/R (Rprofile.site is here)
| /usr/lib/R

Also /usr/share/R for architecture-independent files.

| Downloaded Packages seem to go here:
| /usr/local/lib/R/site-library/

Slightly more complex:  
 -- 'base R' and recommended packages are in	/usr/lib/R/library/
 -- Debian-packaged R packages are in 	  	/usr/lib/R/site-library/
 -- packages installed by you / R are in 	/usr/local/lib/R/site-library/

You did a great job documenting all things.  A 'fresh set of eyese' review
helps everybody. I suggest you get in touch with the Debian / Ubuntu
maintainers for CRAN (see the CRAN README in bin/linux/{ubuntu,debian} about
making this a more visible document.

Also, for your other emails:   'sudo apt-get install ess'  will just get you
a working ESS.


| -- 
| View this message in context: http://www.nabble.com/installing-R-on-Ubuntu-tp10025949p21894862.html
| Sent from the R help mailing list archive at Nabble.com.
| ______________________________________________
| R-help at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-help
| PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
| and provide commented, minimal, self-contained, reproducible code.

Three out of two people have difficulties with fractions.

More information about the R-help mailing list