R:apt-get install r-cran-foo vs. install.packages(“foo”) [英] R: apt-get install r-cran-foo vs. install.packages("foo")

查看:277
本文介绍了R:apt-get install r-cran-foo vs. install.packages(“foo”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu下安装R软件包(在本例中为 mcmcpack )时,可以选择以下两种安装方法:

When installing R packages (say mcmcpack in this example) under Ubuntu I have the choice between the following two methods of installation:

# Let the distribution's packaging system take care of installation/upgrades
apt-get install r-cran-mcmcpack

# Let R take care of installation/upgrades
install.packages("mcmcpack")

问题:


  • 安装R软件包的两种方法中有哪一种被认为是最佳实践?

  • 假设我第一个 install.packages(mcmcpack)以及 apt-get install r-cran-mcmcpack 我应该期待麻烦吗?

  • 假设我第一个 apt-get install r-cran-mcmcpack ,然后在 install.packages(mcmcpack) - 我应该期待什么麻烦吗?

  • Is any of the two ways of installing R packages considered "best practice"?
  • Assume that I first install.packages("mcmcpack") and later on apt-get install r-cran-mcmcpack - should I expect trouble?
  • Assume that I first apt-get install r-cran-mcmcpack and later on install.packages("mcmcpack") - should I expect trouble?

推荐答案

这不像看起来那么容易。

It's not as easy as it seems.


  • apt-get更新是好的,如果和当


  • 包存在 - 但只有大约150左右 r-cran - * 包裹在CRAN上的2100+套餐中,所以相当稀疏的覆盖

  • packages exist -- but there are only around 150 or so r-cran-* packages out of a pool of 2100+ packages on CRAN, so rather sparse coverage

包被维护,无bug和现在

packages are maintained, bug free and current

您很满意Ubuntu的双年发行版

you are happy enough with the bi-annual releases by Ubuntu

install.packages()及以后 update.packages )是好的,如果和当

install.packages() and later update.packages() is good if and when


  • 你知道需要什么内置时间依赖除了 r-base-dev )安装

你不介意运行 update.packages(),以及 apt-get 更新。

you don't mind running update.packages() by hand as well as the apt-get updates.

在我的Ubuntu机器上,我第二个解决方案。但是,如果您有足够的覆盖范围,第一个更好,那么我们已经构建了 cran2deb ,它为amd64和i386提供了2050多个二进制deb包,但仅适用于Debian测试。那就是我在家里使用的。

On my Ubuntu machine at work, I go with the second solution. But because the first one is better if you have enough coverage, we have built cran2deb which provides 2050+ binary deb packages for amd64 and i386 --- but only for Debian testing. That is what I use at home.

关于你是否应该期待麻烦的最后一个问题:不,因为 R_LIBS_SITE / etc / R / Renvironment 中设置为

As for last question of whether you 'should you expect trouble': No, because R_LIBS_SITE is set in /etc/R/Renvironment to be

# edd Apr 2003  Allow local install in /usr/local, also add a directory for
#               Debian packaged CRAN packages, and finally the default dir 
# edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:\
/usr/lib/R/site-library:/usr/lib/R/library'}

这意味着您的包进入 / usr / local / lib / R / site-library 而由 apt 管理的那些进入 / usr / lib / R / site-library 和(在基础包的情况下) / usr / lib / R / library

which means that your packages go into /usr/local/lib/R/site-library whereas those managed by apt go into /usr/lib/R/site-library and (in the case of base packages) /usr/lib/R/library.

希望明确事项。 r-sig-debian邮件列表是一个更加了解这方面问题的地方。

Hope that clarifies matters. The r-sig-debian mailing list is a more informed place for questions like this.

这篇关于R:apt-get install r-cran-foo vs. install.packages(“foo”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆