Rstudio 中的包安装失败,如何确定是什么问题? [英] Package installation failing in Rstudio, how to determine what is wrong?

查看:163
本文介绍了Rstudio 中的包安装失败,如何确定是什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to install rmarkdown in Rstudio. Installation fails because it is trying to instal into the wrong folder, which doesn't exist. Why is it trying to install into the folder .Rprofile/win-library/3.2, eventhough i've configured it to install into R/win-library/3.2?

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

I get the same error if i don't specify the lib parameter for install.packages.

> .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 不起作用:

Update: something odd is going on with libPaths, changing libPaths doesn't work now:

> .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 如下:

Debugging libPaths is see the following:

....
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 将文件夹/R/替换为/.Rprofile/.这可能是什么原因?

So normalizePath replaces the folder /R/ with /.Rprofile/. What could be the cause of that?

推荐答案

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

Resolved by reinstalling R, RRO and RStudio into folders that don't contain spaces...

这篇关于Rstudio 中的包安装失败,如何确定是什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆