[英]Can't import a package using library() command - R Studio
I was trying to import the package "ggplot2", which I already downloaded, and can't do it through library(ggplot2) command. 我试图导入已经下载的软件包“ ggplot2”,但无法通过library(ggplot2)命令执行。 It gives me the following error message:
它给了我以下错误信息:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘ggplot2’
Thanks in advance! 提前致谢!
I would run, 我会跑
install.packages("ggplot2", dependencies = TRUE)
This reinstall ggplot2
and "install uninstalled packages which these packages depend" (from ?install.packages
). 这将重新安装
ggplot2
并“安装这些软件包所依赖的已卸载软件包”(来自?install.packages
)。
Try seeing where your libraries are being downloaded + installed to (not sure what the defaults are on Windows), and then see if R knows where to find them by using the .libPaths()
command. 尝试查看将库下载并安装到的位置(不确定Windows上的默认值),然后查看R是否知道使用
.libPaths()
命令在哪里找到它们。
If not, add the directory where they are to your R environment as described in [this post] ( RStudio can't find my library on startup ) and see whether that helps. 如果不是,请按照[本文]中的描述将它们所在的目录添加到R环境中( RStudio在启动时找不到我的库 ),然后查看是否有帮助。
.Library.site <- "\\\\\\\\gregorp.homedir.nebula.washington.edu/homes/R/win-library/2.15"
If it helps (but only if it does!) add it to your .Rprofile. 如果有帮助(但只有有帮助!),将其添加到您的.Rprofile中。
I've finally managed to make gglopt2 work! 我终于设法使gglopt2正常工作了! I just downloaded "Rcpp" and then everything was fine (don't know why it didn't work last time...).
我刚刚下载了“ Rcpp”,然后一切都很好(不知道为什么上次它不起作用...)。 Thank you all for your help!
谢谢大家的帮助! ;) Best wishes.
;) 最好的祝愿。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.