[英]Loading R packages from custom library locations when there's no read/write access to default library location
We use R at my university, where all computers run Windows XP or Windows 7 and read/write access to most places on the C drive is disabled. 我们在我的大学使用R,那里的所有计算机都运行Windows XP或Windows 7,并且禁用了对C盘上大多数位置的读/写访问。 This includes the default directory for downloading and installing R packages, but does not include the Downloads folder, so I've been using this work-around:
这包括用于下载和安装R软件包的默认目录,但不包括Downloads文件夹,因此我一直在使用以下解决方法:
install.packages("plyr",lib="C:/Users/g-rde434/Downloads/")
library(plyr,lib.loc="C:/Users/g-rde434/Downloads/")
where g-rde434
is the username and I'm just using plyr
as an example. 其中
g-rde434
是用户名,我plyr
为例。 For packages that require a lot of other packages in order to work, this gets messy because I've found that I have to manually install all the depends before I can install the package I actually want to use. 对于需要大量其他软件包才能工作的软件包,这很麻烦,因为我发现必须先手动安装所有依赖项,然后才能安装我实际想要使用的软件包。 For instances, packages like
ggplot2
and sirt
each require a whole bunch of other packages to work properly. 例如,
ggplot2
和sirt
类的软件包都需要一大堆其他软件包才能正常工作。 Is there a much easier way to do what I'm trying to do? 有没有更简单的方法可以做我想做的事情? I'm not asking about clever vectorizing tricks or anything like that, but rather some way to force the "higher-up" packages (eg,
ggplot2
or sirt
) to load all the other packages it needs from the library location I specified above? 我不是在问巧妙的矢量化技巧或诸如此类的事情,而是要以某种方式强制“更高版本”的软件包(例如
ggplot2
或sirt
)从我在上面指定的库位置加载所需的所有其他软件包?
Please try: 请试试:
install.packages("plyr", lib="C:/Users/g-rde434/Downloads/", dependencies=TRUE)
For further reference see: How to tell CRAN to install package dependencies automatically? 有关更多参考,请参见: 如何告诉CRAN自动安装软件包依赖项?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.