Web services
Blog categories
Top blog posts
Recent comments
Stats
- 17,128 hits
R can be easily installed on Ubuntu using apt:
Open a terminal window and execute
sudo apt-get install r-base
To install a new package and save the files at /usr/R-libs, first make sure that /usr/R-libs is writeable, then start R:
> install.packages(“package name”, lib=”/usr/R-libs”)
To load the package from /usr/R-libs
> library(“package name”, lib.loc=”/usr/R-libs”)
That’s all
Hi Jonas,
Thank you for the help. I followed them and installed R successfully. Quite new in linux but am learning.
Hi Jonas,
Thanks for your post. Everything is working except that this is currently for R 2.12.1 64bit. I however would like to upgrade to 2.13.0 the current R version but ran into a problem which I described here:
Any advice on this would be great. thanks.
http://superuser.com/questions/279088/installing-the-latest-r-version-2-13-0-on-ubuntu-11-04
Hi Jan,
Yes, I assume this is due to dependency issues, and this is a problem that can be very frustrating to try to solve. Is the difference between 2.12.1 and 2.13.0 important? Otherwise I would just wait and rely on apt-get upgrade.
Regards,
Jonas
PS. You can download (from http://www.r-project.org/) and install r-base-core_2.13.0-1natty0_i386.deb or r-base-core_2.13.0-1natty0_amd64.deb to run R v2.13.0 on Ubuntu 11.04, but there may be additional problems.
Hi Jonas,
I currently have R version 2.11.1 but I would like to upgrade to 2.12 to use some packages. I’ve searched around the web and nothing!!! How can I do it???
Hi Sakti,
I upgraded to 2.12.1 by opening a terminal window and running this command: sudo apt-get upgrade r-base
Jonas
Thanks so much Jonas, it worked!!!!
Hi Jonas,
I install the R like you saw, but i don’t found the R-libs, or the program…
Check that the “multiverse” software is enabled in System > Administration > Synaptic Package Manager and Settings > Repositories
Pingback: How to install R on Ubuntu 11.10 Oneiric Ocelot « Jonas Ranstam's website
Hi! im very new to using Ubuntu 11.10 (not a techy as well) and I am trying to install R.
I am done with the first step. I have a few question:
“To install a new package and save the files at /usr/R-libs, first make sure that /usr/R-libs is writeable, then start R:” >> how can i make sure that /usr/R-libs is writeable?
also, “> install.packages(“package name”, lib=”/usr/R-libs”)”, what shall i write in “package name”?
when i copied that syntax “install.packages(“package name”, lib=”/usr/R-libs”)”, I got an error
“install.packages(“package name”, lib=”/usr/R-libs”)”
Can you help me with this please?
Hi dixi,
You can read about Linux file permissions here.
To set write permission to /usr/R-libs for all users using the commandline, first open a terminal window (press the “Ctrl”, “Alt” and “t” keys at the same time). Then run the command: sudo chmod 777 /usr/R-libs.
Another alternative is to save the package at another folder under your home directory. R will suggest one to you if /usr/R-libs turns out to be unwriteable.
You can read about the different R-packages here. Look for Download, Packages in the left column.
Thank you for the response but I still can not follow it. It seems that I do not have R-lib.
dixi@dixi-System-Product-Name:/usr$ ls -l
total 200
drwxr-xr-x 2 root root 69632 2012-01-20 11:03 bin
drwxr-xr-x 2 root root 4096 2011-11-02 10:44 games
drwxr-xr-x 38 root root 16384 2012-01-17 12:12 include
drwxr-xr-x 240 root root 73728 2012-01-20 11:03 lib
drwxr-xr-x 10 root root 4096 2011-04-26 06:50 local
drwxr-xr-x 2 root root 12288 2012-01-03 09:44 sbin
drwxr-xr-x 350 root root 12288 2012-01-17 12:12 share
drwxrwsr-x 15 root src 4096 2011-12-13 11:45 src
i checked /usr/lib/R. within the R folder i have lib and library folder. The library folder has a locked icon on it.
i tried sudo chmod 777 /usr/lib/R/lib and sudo chmod 777 /usr/lib/R/library. then install.packages(“r-cran-boot”,lib=”/usr/lib/R/lib”) or install.packages(“r-cran-boot”,lib=”/usr/lib/R/library”)
but i get
bash: syntax error near unexpected token `”r-cran-boot”,lib=”/usr/lib/R/library”‘
btw, i also check synaptic manager and “multiverse” has a checked on it. The same for restricted, universe and main.
If you wish to install the package in the folder /usr/R-libs and this does not exist, just create it.
Then make the folder writeable as above and install the package again. Note that install.packages(“r-cran-boot”,lib=”/usr/lib/R/library”) is an R-command and should be run in an R console (start R by typing “R” in a terminal window), not at the bash prompt. If you wish to do that, use this is the command:
R CMD INSTALL r-cran-boot -l /usr/lib/R/library
To get more information on this subject, type ?INSTALL in an R console.