Ubuntu 10.10下简单安装配置R环境


向 /etc/apt/sources.list 中加入:

deb http://ftp.ctex.org/mirrors/CRAN/bin/linux/Ubuntu maverick/

Secure apt

The Ubuntu archives on CRAN are signed with the key of "Michael Rutter <marutter@gmail.com>" with key ID E084DAB9. You can fetch this key with

gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9

and then feed it to apt-key with

gpg -a --export E084DAB9 | sudo apt-key add -

安装完整的R system, 使用

sudo apt-get update
sudo apt-get install r-base

管理和维护R包

The R packages part of the Ubuntu r-base and r-recommended packages are installed into the directory /usr/lib/R/library.
The other r-cran-* packages shipped with Ubuntu are installed into the directory /usr/lib/R/site-library.
These can be updated using apt-get with

sudo apt-get update
sudo apt-get upgrade

整体分为三部分进行管理:
1. R本身 和一些库 用 apt-get 进行更新
2. 官方推荐包 默认存在于 /usr/lib/R/library 可用管理员权限下的 update.packages() 更新
3. 用户安装包 默认存在于 /usr/lib/R/site-library 可用管理员权限下的 update.packages() 更新

如果用非管理员的用户去装包, 会装到另外一个新文件夹中. 因为对以上目录没有写权限.

如果用非管理员权限装包, 会装到另外一个新文件夹中. 因为对以上目录没有写权限. 用管理员权限会默认装到 /usr/local/lib/R/site-library 里. 更新的时候亦然.

sudo gedit /etc/R/Rprofile.site  # 修改默认CRAN镜像

手工安装依赖了特别库的包

安装程序包'Cairo'时退出狀態的值不为0
安装程序包'rgl'时退出狀態的值不为0
安装程序包'XML'时退出狀態的值不为0:
安装程序包'RCurl'时退出狀態的值不为0
安装程序包'cairoDevice'时退出狀態的值不为0
安装程序包'fftw'时退出狀態的值不为0
安装程序包'rcdd'时退出狀態的值不为0
安装程序包'rgdal'时退出狀態的值不为0
依赖rgl引起的:
installation of package 'ks' had non-zero exit status
installation of package 'feature' had non-zero exit status
installation of package 'flowCore' had non-zero exit status
installation of package 'flowViz' had non-zero exit status 

安装Cairo:

sudo apt-get install libcairo2-dev libxt-dev

然后install.packages("Cairo")即可

安装cairoDevice:

sudo apt-get install r-cran-cairoDevice

安装rgl包:

sudo apt-get install r-cran-rgl

安装fftw包:

sudo apt-get install libfftw3-dev

然后install.packages("fftw")即可

安装rcdd包:

sudo apt-get install libgmp3-dev

然后install.packages("rcdd")即可

安装rgdal包:

sudo apt-get install libgdal-dev libproj-dev

然后install.packages("rgdal")即可

安装XML包:

sudo apt-get install libxml++2.6-dev

然后install.packages("XML")即可

装好以上就能装RCurl了, 初步猜测可能是依赖libxml导致的.

安装rimages包:

sudo apt-get install fftw-dev fftw2

然后install.packages("rimage")即可

安装RKWard daily版
sudo add-apt-repository ppa:rkward-devel/rkward-dailys

然后

sudo apt-get update
sudo apt-get install rkward
sudo apt-get dist-upgrade

即可安装RKWard daily版.

相关内容