Installing R in Ubuntu

421 篇文章 14 订阅

Universe

The current version of R available when a new version of Ubuntu is released is always available in the universe repository. To install R:

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

This will install R, the recommended packages, and files needed to install many additional packages (but not all) from within R using install.packages("foo"). The R packages found in the universe repository are not updated when new versions of R or the recommended packages are released.

CRAN

CRAN has current versions of R and the recommended packages available for all currently supported versions of Ubuntu. Detailed instructions for adding the CRAN repositories can be found here. The first step is to add the security key:

 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 

Then you need to add the CRAN repository to end of /etc/apt/sources.list:

 deb http://cran.r-project.org/bin/linux/ubuntu precise/ 

The CRAN web address can be replaced with a local <a href="deb http:///bin/linux/ubuntu precise/”>mirror and the precise/ should be replaced with the version of Ubuntu you are using. R can then be installed:

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

The packages on CRAN are updated on a regular basis and the most recent versions will be usually be available within a couple days of their release. One advantage of using the CRAN repository is that older versions of packages are available. To install an older version of a package, it must be pinned. Directions for pinning are different for apt-get and synaptic and details can be found here.

Launchpad PPA

Packages for the CRAN repository are built on a Launchpad PPA called RutteR. It is possible to use the PPA itself, which includes a few more packages than the CRAN repository (JAGS and related packages, for example). Installing the PPA via apt is very simple:

 sudo add-apt-repository ppa:marutter/rrutter sudo apt-get update sudo apt-get install r-base r-base-dev 

The PPA is updated slightly quicker than the CRAN repository, but older packages are not available.

If you have any questions about the CRAN or PPA repositories, please email the maintainerMichael Rutter.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值