-->

Error in loadNamespace(i, c(lib.loc, .libPaths()),

2019-09-06 00:55发布

问题:

This question already has an answer here:

  • Error in loadNamespace(name) : there is no package called 'Rcpp' 5 answers

Basically I want to use wordcloud function. I'm working through R console. But I could use Rstudio if thats the problem.

When I use

 wordcloud(r_stats_text_corpus)
 Error: could not find function "wordcloud"

I also tried

library("wordcloud")
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘wordcloud’

Then:

install.packages("Rcpp")
Installing package into ‘C:/Users/Abbas/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://pbil.univ-lyon1.fr/CRAN/bin/windows/contrib/3.2/Rcpp_0.12.3.zip'
Content type 'application/zip' length 3197148 bytes (3.0 MB)
downloaded 3.0 MB

package ‘Rcpp’ successfully unpacked and MD5 sums checked

Warning: unable to move temporary installation ‘C:\Users\Abbas\Documents\R\win-library\3.2\file2388511e56ac\Rcpp’ to ‘C:\Users\Abbas\Documents\R\win-library\3.2\Rcpp’
The downloaded binary packages are in
        C:\Users\Abbas\AppData\Local\Temp\RtmpwrnScP\downloaded_packages

When I check the path C:\Users\Abbas\Documents\R\win-library\3.2\file2388511e56ac\Rcpp I could only find empty folder. Still I moved this folder to C:\Users\Abbas\Documents\R\win-library\3.2\Rcpp. Even after this when i try to load Rcpp package I get the error.

library("Rcpp")
Error in library("Rcpp") : there is no package called ‘Rcpp’

Also when checking the path C:\Users\Abbas\AppData\Local\Temp\RtmpwrnScP\downloaded_packages, I can see zip file Rcpp_0.12.3 there.

Help!

EDIT: When I'm trying this through Rstudio, What am I missing on here?

> install.packages(Rcpp)
Error in install.packages : object 'Rcpp' not found
> source('~/.active-rstudio-document', echo=TRUE)

回答1:

Thanks for the help. I got the fix! Manually extracted the Rcpp zip file to path mentioned in .libPaths()