R: apt-get install r-cran-foo vs. install.packages("foo") [英] 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 onapt-get install r-cran-mcmcpack
- should I expect trouble? - Assume that I first
apt-get install r-cran-mcmcpack
and later oninstall.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屋!