如何从github存储库安装开发版R包时指定lib目录 [英] How to specify lib directory when installing development version R Packages from github repository
问题描述
lib / usr / lib / R / site-library
来安装所有R软件包。 / code>选项在 install.packages()
中。 但是,当我尝试使用 install_github()
安装R包的开发版本时,它总是安装在系统用户的本地存储库中。
.libPaths()
有4个目录,包括本地存储库。所以,我有两个问题,如果我从本地存储库中删除本地存储库,它是否会安装在其他3个存储库中的任何一个存储库中?
-
code> .libPaths()
? 是否有任何方法指定 install_github()
?
我使用 Ubuntu 12.04 64bit
和 R 3.0.1
--------- ------------- UPDATE --------------------------------
-
无法从
.libPaths()
-
如果我尝试在 RStudio 中使用
install_github()
进行安装,它将安装在local repository
,因为没有指定lib
。 >如果我尝试使用install_github()
作为非root用户进行安装,它将安装在本地存储库
因为没有指定
lib
。 -
如果我尝试安装使用
install_github()
作为 root用户,它将安装在/ usr / local / lib / R / site-library ,因为未指定
lib
。
有没有指定安装库
?
在 devtools
中添加指定的库路径,我们需要使用 with_libpaths()
with_libpaths()
的参数是, with_libpaths(new,code)
以下是使用 with_libpaths()
,
library(devtools)
with_libpaths(new =/ usr / lib / R / site-library /,install_github('rCharts','ramnathv'))
礼貌:Hadley, here :)
除 with_libpaths()
外,还有更多选项可用于 devtools :: with_something()
in_dir:工作目录
with_collate:整理顺序
with_envvar:环境变量
with_libpaths:库路径,替换当前libpaths
with_lib:库路径,预先加入当前libpaths
with_locale:任何语言环境设置
with_options:options
with_path:PATH环境变量
with_par:图形参数
更多解释这里
In Ubuntu, I am installing all the R packages in the directory, /usr/lib/R/site-library
by specifying lib
option in install.packages()
.
But when I try to install the development version of the R packages using, install_github()
, it always installs in a local repository of the system user.
.libPaths()
has 4 directories including the local repository. So, I have 2 questions,
Will it install in any of the other 3 repositories if i remove the local repository from
.libPaths()
?Is there any way to specify installation library path in
install_github()
?
I am using Ubuntu 12.04 64bit
and R 3.0.1
----------------------UPDATE--------------------------------
Unable to remove the local repository from
.libPaths()
If I try to install using
install_github()
in RStudio, it installs in thelocal repository
sincelib
is not specified.If I try to install using
install_github()
as non-root user, it installs in thelocal repository
sincelib
is not specified.If I try to install using
install_github()
as root user, it installs in the/usr/local/lib/R/site-library
sincelib
is not specified.
Is there any to specify installation lib
?
To add specified library paths in devtools
, we need to use with_libpaths()
Arguments for with_libpaths()
are, with_libpaths(new, code)
Following is an example for using with_libpaths()
,
library(devtools)
with_libpaths(new = "/usr/lib/R/site-library/", install_github('rCharts', 'ramnathv'))
Courtesy: Hadley, here :)
And other than with_libpaths()
, there are more options for in devtools::with_something()
in_dir: working directory
with_collate: collation order
with_envvar: environmental variables
with_libpaths: library paths, replacing current libpaths
with_lib: library paths, prepending to current libpaths
with_locale: any locale setting
with_options: options
with_path: PATH environment variable
with_par: graphics parameters
More explanations here
这篇关于如何从github存储库安装开发版R包时指定lib目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!