Reputation: 97
library(caret)
Loading required package: ggplot2 Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘gtable’ Error: package ‘ggplot2’ could not be loaded
Upvotes: 7
Views: 74268
Reputation: 21
Wrote the command
install.packages("caret")
on my rmd file and had problems with the installation. It was solved just by typing the same line in the console.
Upvotes: 0
Reputation: 21
when attempting: install.packages("caret")
I'm getting the following errors:
Warning: unable to access index for repository https://cran.mtu.edu/src/contrib: cannot open URL 'https://cran.mtu.edu/src/contrib/PACKAGES' Warning: unable to access index for repository https://cran.mtu.edu/bin/macosx/el-capitan/contrib/3.6: cannot open URL 'https://cran.mtu.edu/bin/macosx/el-capitan/contrib/3.6/PACKAGES' Warning message: package ‘~/Downloads/caret’ is not available (for R version 3.6.1)
(yes, I should upgrade)
Solved by installing from the Rstudio CRAN repo:
install.packages('caret', repos='http://cran.rstudio.com/')
Upvotes: 1
Reputation: 136
I had a similar issue for another package, and the easiest way to fix it was as follows(in RStudio):
After this I had no problems.
Upvotes: 1
Reputation: 21
In Ubuntu:
sudo apt-get update
sudo apt-get install r-cran-caret
Upvotes: 2
Reputation: 21
Try this ...
install.packages('caret', repos='http://cran.rstudio.com/')
Upvotes: 1
Reputation: 33
I had the same problem when updating to R 3.5, if you changed R versions using something like the updater
function from the installr
package, it has some problems copying the libraries between major releases (3.4 -> 3.5).
The solution that worked for me was installing manually all the previous libraries.
Upvotes: 0
Reputation: 1
As Ian suggested, try installing the package mentioned in the error message. I had the same issue and the error was 'there is no package as Biobase'. So I searched on the web for Biobase, installed it, tried library(caret) and it asked for another package and I kept installing till library(caret) worked. In your case, it shows 'there is no package called ‘gtable’. So start with installing gtable and load caret and keep at it.
Upvotes: 0
Reputation: 45
So what worked for me is a bit old school: after installing the caret package and getting that error, I did a quick search on my PC for caret (In my case; I went to ThisPC > RoseAdediran), deleted the caret folder, searched for plyr
and deleted the folder as well. Went back to RStudio, restarted the session and tried this code again
install.packages('caret', dependencies=T)
library(caret)
Once you load the library, other imports would be loaded as well.
Upvotes: 1
Reputation: 1604
I had the same issue (R 3.5 for Windows).
Just had to keep going installing the missing dependencies until everything installed (for me there were about 10 dependencies missing)
This even required changing to a different mirror when the files could not be found!
Hope this helps someone in future...
> install.packages('caret', dependencies = TRUE)
> library('caret')
Loading required package: ggplot2 Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘gtable’ Error: package ‘ggplot2’ could not be loaded
> install.packages('gtable', dependencies = TRUE)
> install.packages('ggplot2', dependencies = TRUE)
> library('caret')
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gower’
> install.packages('gower', dependencies = TRUE)
...
Upvotes: 2
Reputation: 280
just try this
install.packages(pkgs = "caret",
dependencies = c("Depends", "Imports"))
Upvotes: -1