我从二进制文件在R 4.0.2中安装软件包时遇到了一些问题。这是我的尝试:
> install.packages("C:/Users/MNestor/Downloads/libSBML_5.18.0.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/MNestor/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)
package ‘libSBML’ successfully unpacked and MD5 sums checked
Warning messages:
1: multiple methods tables found for ‘type’
2: multiple methods tables found for ‘type<-’
下一步,我加载库:
> library('libSBML')
Error: package or namespace load failed for ‘libSBML’:
package ‘libSBML’ was installed before R 4.0.0: please re-install it
此错误令我感到困惑,因为我正在R 4.0.2中工作,并且显然刚刚完成了全新安装。
我尝试过
remove.packages('libSBML')
并重新安装作为参考,这是我的图书馆目录:
> .libPaths()
[1] "C:/Users/MNestor/Documents/R/win-library/4.0"
[2] "C:/Program Files/R/R-4.0.2/library"
libSMBL
文件夹位于第一个库路径中,而不是第二个(如预期的那样)。
以下是会话信息:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] rsbml_2.46.0 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] BiocManager_1.30.10 compiler_4.0.2 tools_4.0.2 remotes_2.2.0
[5] stats4_4.0.2 SBMLR_1.84.0 graph_1.66.0
答案 0 :(得分:1)
该错误消息可能有点令人困惑,但是它表示该软件包已经针对R的早期版本进行了编译(这就是“ win.binary”选项的含义)。
由于更新的编译器和构建工具,R 4.0和早期版本的二进制文件不兼容。
您需要从源代码安装软件包,这可能意味着安装R工具(https://cran.r-project.org/bin/windows/Rtools/),或者您需要使用为R 4.0或更高版本预先构建的版本。