【发布时间】:2019-09-24 09:19:16
【问题描述】:
我不小心取消了我的图书馆的链接。
unlink(C:/Users/.../R/win-library/3.6")
所以我重新安装了 R 和 R Studio。自此,我有很多麻烦。如果我想安装一个包,例如
install.packages("haven")
或
install.packages("haven", dependencies = TRUE)
我收到这条消息:
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
Error in install.packages : cannot open file 'C:/Users/.../R/win-library/3.6/file2d6465c81796/backports/DESCRIPTION': Permission denied
我过去曾多次安装并重新安装 R,但从未遇到过这些问题。所以肯定和我之前做的unlink操作有关。此外,如果我想安装一个包,R 会安装大量的附加包(例如haven)。
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/.../R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘backports’, ‘digest’, ‘glue’, ‘zeallot’, ‘assertthat’, ‘utf8’, ‘ellipsis’, ‘magrittr’, ‘rlang’, ‘pkgconfig’, ‘vctrs’, ‘R6’, ‘clipr’, ‘crayon’, ‘BH’, ‘cli’, ‘fansi’, ‘pillar’, ‘forcats’, ‘hms’, ‘Rcpp’, ‘readr’, ‘tibble’
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1
【问题讨论】:
-
您是否尝试按照错误消息的建议重新安装 Rtools?
-
“权限被拒绝”的解决方法是使用
sudo R从终端启动 R,然后安装您的软件包。您可以返回 Rstudio 使用该软件包。丑陋但对我有用。 -
@Chelmy88:不,如果我安装 RTools,没有任何变化。
-
@ haci:是的,我在这里读到了这个修复:stackoverflow.com/questions/32540919/library-is-not-writable。但是,我以前从未遇到过这个问题。所以肯定发生了一些变化。