s7c s7c - 1 month ago 15
R Question

Installed packages in R

K, it seems like I have a problem.
I'm trying to access the Hmisc package, which of course is installed.
And i get this error:

in Rstudio:


Loading required package: ggplot2
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package ‘ggplot2’ could not be loaded


in R:


Error in unloadNamespace(package) :
namespace ‘ggplot2’ is imported by ‘caret’ so cannot be unloaded
Error in library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc, :
Package ‘ggplot2’ version 1.0.1 cannot be unloaded


I already have ggplot2 and caret but I wasn't sure about Rcpp, so I decided to install both. For that I used the function: install.packages('', dep = TRUE)
The ggplot 2 installs smoothly and the same with Rcpp but with a warning:


Warning in install.packages :
cannot remove prior installation of package ‘Rcpp’


Same warning in caret.

Anyway, nothings changes when I try to access the Hmisc library.

Maybe it helps to say I updated both (R and RStudio) few days ago with the latest versions and the installed packages are in my working directory.
Something was/is definitely wrong, cause I got some error running a program which was processed by other persons without any errors. That was one of the reasons I decided to update...

I feel like I'm going crazy and don't know what to do. Any constructive idea is much appreciated.

Answer

This sometimes happens with a package. What you can do is go to the library folder where all the packages are installed, find the Rcpp directory and delete this. Then reinstall Rcpp from cran. This should solve the issue.