如何安装库(读取器)?

时间:2015-10-04 10:12:23

标签: r

我很惊讶images无法突然加载:

library(readr)

所以我试过了:

library(readr)
Error in loadNamespace(j <- imp[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘Rcpp’
In addition: Warning message:
package ‘readr’ was built under R version 3.2.2 
Error: package or namespace load failed for ‘readr’

之后,我尝试了SO:

install.packages("Rcpp") #with all dependencies
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/Rcpp_0.12.1.zip'
Content type 'application/zip' length 3189720 bytes (3.0 MB)
downloaded 3.0 MB

package ‘Rcpp’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘Rcpp’

The downloaded binary packages are in
C:\Users\m\AppData\Local\Temp\RtmpMd0LfX\downloaded_packages

我错过了什么吗?

1 个答案:

答案 0 :(得分:13)

您使用的是Windows,尝试更新涉及已编译代码的软件包(例如readr和Rcpp)时遇到了一些问题。基本上,如果加载了这些包,则无法更新它们;并且没有办法卸载它们。因此,您需要以“vanilla”模式重新启动R(即,只加载基础包)。从命令提示符执行:

R --vanilla

然后,您应该能够安装这些包。我会尝试:

install.packages(c("Rcpp", "readr"))

你应该好好去。