Rstudio中的软件包安装失败,如何确定哪里出错?

时间:2015-08-19 08:44:08

标签: r rstudio

我试图在Rstudio中安装rmarkdown。安装失败,因为它试图安装到不存在的错误文件夹中。为什么要安装到文件夹.Rprofile / win-library / 3.2中,虽然我已将其配置为安装到R / win-library / 3.2中?

如果我没有为install.packages指定lib参数,我会得到同样的错误。

> .libPaths()
[1] "c:/Users/ako/Documents/R/win-library/3.2" "C:/Program Files/RRO/R-3.2.1/library"    
> install.packages("rmarkdown",lib="c:/Users/ako/Documents/R/win-library/3.2")
trying URL 'https://mran.revolutionanalytics.com/snapshot/2015-07-01/bin/windows/contrib/3.2/rmarkdown_0.7.zip'
Content type 'application/zip' length 1310297 bytes (1.2 MB)
downloaded 1.2 MB

Error in install.packages : path[1]="c:\Users\ako\Documents\.Rprofile\win-library\3.2": The system cannot find the path specified

更新:libPaths发生了一些奇怪的事情,改变libPaths现在还没有工作:

> .libPaths()
[1] "c:/Users/ako/Documents/.Rprofile/win-library/3.2" "C:/Program Files/RRO/R-3.2.1/library"            
> file.exists("c:/Users/ako/Documents/R/win-library/3.2")
[1] TRUE
> .libPaths("c:/Users/ako/Documents/R/win-library/3.2")
> .libPaths()
[1] "c:/Users/ako/Documents/.Rprofile/win-library/3.2" "C:/Program Files/RRO/R-3.2.1/library"  

调试libPaths见以下内容:

....
Browse[2]> 
debug: new <- Sys.glob(path.expand(new))
Browse[2]> new
[1] "c:/Users/ako/Documents/R/win-library/3.2"
Browse[2]> 
debug: paths <- unique(normalizePath(c(new, .Library.site, .Library), 
    "/"))
Browse[2]> c(new, .Library.site, .Library)
[1] "c:/Users/ako/Documents/R/win-library/3.2" "C:/PROGRA~1/RRO/R-32~1.1/library"        
Browse[2]> normalizePath(c(new, .Library.site, .Library), 
+ "/")
[1] "c:/Users/ako/Documents/.Rprofile/win-library/3.2" "C:/Program Files/RRO/R-3.2.1/library"  

因此normalizePath用/.Rprofile/替换文件夹/ R /。可能是什么原因?

1 个答案:

答案 0 :(得分:0)

通过将R,RRO和RStudio重新安装到不包含空格的文件夹中解决...