Questions tagged «library-path»

14
在Rprofile.site中使用.libPaths更改R默认库路径无法正常工作
我在Windows上运行R,而不是以管理员身份运行。安装软件包时,以下命令不起作用: > install.packages("zoo") Installing package(s) into ‘C:/Program Files/R/R-2.15.2/library’ (as ‘lib’ is unspecified) Warning in install.packages : 'lib = "C:/Program Files/R/R-2.15.2/library"' is not writable 要安装软件包,我必须指定一个库位置: install.packages("zoo", lib="C:/software/Rpackages") 要加载软件包,我还必须指定库位置: library("zoo", lib.loc="C:/software/Rpackages") 所有这些都可以,但是我想看看是否可以C:/software/Rpackages以某种方式添加到库路径,因此不必每次都键入它。 当我在线搜索时,发现执行此操作的一种方法是编辑Rprofile.site文件并添加行 .libPaths("C:/software/Rpackages") 但是,执行此操作并启动RStudio之后,这是我得到的输出 > .libPaths() [1] "C:/Program Files/R/R-2.15.2/library" "C:/Program Files/RStudio/R/library" 在.libPaths我加入命令Rprofile.site似乎并没有有任何影响!为什么会这样呢?更重要的是,如何解决该问题,以便无需键入库位置即可安装和加载软件包? 注意:如果我启动RStudio,该.libPaths()命令似乎可以正常运行 .libPaths("C:/software/Rpackages") > .libPaths() [1] "C:/software/Rpackages" "C:/Program Files/R/R-2.15.2/library" 那不是很奇怪吗?
205 r  rstudio  r-faq  library-path 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.