Ubuntu12.04
R-3.1.0
0.Ubuntu安装R官网的介绍
http://mirrors.ustc.edu.cn/CRAN/
Precise Pangolin (12.04; LTS),
与12.04对应的是
add deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu precise/in your /etc/apt/sources.list file, replacing<my.favorite.cran.mirror> by the actual URL of your favorite CRANmirror. See http://cran.r-project.org/mirrors.html for the list ofCRAN mirrors. To install the complete R system, use
sudo apt-get update
sudo apt-get install r-base
将这行加到
/etc/apt/sources.list文件,然后用实际的URL替换<my.favorite.cran.mirror>
总结了一下,有以下三步:
步骤1.
sudo sh -c "echo deb http://mirrors.ustc.edu.cn/CRAN//bin/linux/ubuntu precise/ >>/etc/apt/sources.list"
步骤2.
sudo apt-get update
步骤3.
sudo apt-get install r-base
4.可能遇到的问题
a. W: GPG 错误:http://mirrors.ustc.edu.cn precise/ Release: 由于没有公钥,无法验证下列签名: NO_PUBKEY 51716619E084DAB9
解决:
下载密匙: sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 51716619E084DAB9 导入密匙: gpg --keyserver subkeys.pgp.net --recv E084DAB9 gpg --export --armor E084DAB9 | sudo apt-key add -
b. W: GPG 错误:http://ppa.launchpad.net precise Release: 下列签名无效: BADSIG 84DBCE2DCEC45805 Launchpad PPA for Damien Cassou
这个错误比较麻烦,参考:
5.安装RStudio
下载:
sudo gdebi rstudio-0.98.507-i386.deb
如果提示没安装gdebi, 则 sudo apt-get install gdebi
6.安装RHive
配置环境变量:
export R_HOME=/usr/lib/R
创建 链接:
ln -s /usr/lib/R/bin/R /usr/bin/R
运行命令:
R CMD javareconf JAVAH=/usr/local/java/jdk1.7.0_51/bin/javah JAR=/usr/local/java/jdk1.7.0_51/bin/jar
ln -s /usr/lib/R/bin/R /usr/bin/R
运行命令:
R CMD javareconf JAVAH=/usr/local/java/jdk1.7.0_51/bin/javah JAR=/usr/local/java/jdk1.7.0_51/bin/jar
启动R :
sudo R
安装rJava:
install.packages("rJava")
install.packages("rJava")
版权声明:本文为博主原创文章,未经博主允许不得转载。