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

查看:25
本文介绍了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 update 如果以及何时

  • 包存在 -- 但在 CRAN 上的 2100 多个包中只有大约 150 个 r-cran-* 包,因此覆盖范围相当稀疏

  • 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

软件包得到维护、无错误和最新

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天全站免登陆