简体   繁体   中英

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. 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 ).

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.

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.

.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.

I've finally managed to make gglopt2 work! I just downloaded "Rcpp" and then everything was fine (don't know why it didn't work last time...). Thank you all for your help! ;) Best wishes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM