首页 > 代码库 > R on Ubuntu

R on Ubuntu

I have been using R recently. R is statistics programming language. R has attracted more and more attention as analytics in cloud gets more and more hot.

 

Don‘t install R in default ubuntu source which only contains a older version. Update apt source according to http://ftp.ctex.org/mirrors/CRAN/. For example, I added the following line to /etc/apt/source.list

 

deb http://bibs.snu.ac.kr/R/bin/linux/ubuntu jaunty/

 

Follow the instructions from here

  1. sudo gedit /etc/apt/sources.list

    This will open up your sources.list file in gedit, where you can add the following line.

  2. deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ version/

    Replace version/ with whatever version of Ubuntu you are using (eg, precise/oneric/, and so on). If you‘re getting a "Malformed line error", check to see if you have a space between /ubuntu/and version/.

  3. Fetch the secure APT key with gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 or gpg --hkp://keyserver keyserver.ubuntu.com:80 --recv-key E084DAB9.

  4. Feed it to apt-key with gpg -a --export E084DAB9 | sudo apt-key add -

  5. Update your sources and upgrade your installation with sudo apt-get update && sudo apt-get upgrade.

 

Install R

sudo apt-get install r-base-dev

 

Install rJava

sudo R CMD javareconf

sudo R to launch RTerm. Issue install.packages(‘rJava‘, dependencies=TRUE) to install rJava.

(Installation of rJava needs root permission so sudo it is needed. sudo R is also needed whenever you want to use rJava in Rterm)

sudo R to launch RTern whenever rJava library needs to be used.

 

There is another way to install rJava. First run `sudo chmod -R 777 /etc/R`. The do all the operations in the previous text without `sudo`.

 

InstallO Other Packages

Use sudo R to launch RTerm

install.packages(‘RWeka‘, dependencies=TRUE)

install.packages(‘kernlab‘, dependencies=TRUE)

install.packages(‘ISwR‘, dependencies=TRUE)

 

Install dependencies packages:

 

- sudo apt-get install libx11-dev

- sudo apt-get install libglu1-mesa-dev

- sudo apt-get install libgl1-mesa-dev

 

In R console, run

 

install.packages(‘Rcmdr‘, dependencies=TRUE)

 

To install ggplot2 and caret, don‘t use dependencies=TRUE. Otherwise, a lot of dependent packages

will be installed. Installation for some of them may fails since some depends on something outside of

R (some ubuntu pacages).

 

http://yaojingguo.iteye.com/blog/513603

http://stackoverflow.com/questions/10476713/how-to-upgrade-r-in-ubuntu

R on Ubuntu