R在哪里存储软件包? [英] Where does R store packages?
问题描述
R中的install.packages()
函数是自动解压缩实用程序,可在R中获取并安装软件包.
The install.packages()
function in R is the automatic unzipping utility that gets and install packages in R.
-
我如何找出R选择存储软件包的目录?
How do I find out what directory R has chosen to store packages?
如何更改R存储和访问软件包的目录?
How can I change the directory in which R stores and accesses packages?
推荐答案
install.packages命令通过.libPaths变量进行查找.这是我在OSX上的默认设置:
The install.packages command looks through the .libPaths variable. Here's what mine defaults to on OSX:
> .libPaths()
[1] "/Library/Frameworks/R.framework/Resources/library"
默认情况下,我不在那里安装软件包,我更喜欢将它们安装在主目录中.在我的.Rprofile中,有以下一行:
I don't install packages there by default, I prefer to have them installed in my home directory. In my .Rprofile, I have this line:
.libPaths( "/Users/tex/lib/R" )
这会将目录"/Users/tex/lib/R"添加到.libPaths变量的前面.
This adds the directory "/Users/tex/lib/R" to the front of the .libPaths variable.
这篇关于R在哪里存储软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!