Error: package or namespace load failed for ggplot2 and for data.table

elisahmendes picture elisahmendes · Jul 30, 2015 · Viewed 215.4k times · Source

I am not able to open install the ggplot2 and data.table packages. It gives me the following error (example for ggplot2)

> library(ggplot2)
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’

I was able to work fine with these 2 packages before I closed my R session. Now it shows me this error each time I try to run it.

I have also tried to remove and re-install it, but without success.

remove.packages(c("ggplot2", "data.table"))
install.packages('ggplot2', dep = TRUE)
install.packages('data.table', dep = TRUE)

I am not sure what's wrong

Answer

elisahmendes picture elisahmendes · Jul 30, 2015

This solved the issue:

remove.packages(c("ggplot2", "data.table"))
install.packages('Rcpp', dependencies = TRUE)
install.packages('ggplot2', dependencies = TRUE)
install.packages('data.table', dependencies = TRUE)