Caret library fails to load

Viewed 6873

I successfully installed caret but when loading the library I get the following error message:

library(caret) Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace ‘generics’ 0.0.2 is already loaded, but >= 0.1.0 is required

what does 0.1.0 refer to?

4 Answers

I had the same issue, apparently some required dependencies for the caret package need to be updated. However installing it with DEPENDENCIES = TRUE, did not fix the problem for me.

What did work was:

Close all your .rmd files in RStudio and then click on the 'update' button in the tab with the packages: enter image description here

This should update all your packages including the ones caret needs be updated, to work with their latest version.

I solved the problem by uninstalling the caret package, restarting R and installing the package from zip file.

It is asking about the latest version of generics package. It could be solved either by manually installing some earlier version of package caret or updating the base r packages. update.packages() If it asks for permission then use sudo

First use this:

install.packages('hardhat') library(hardhat) install.packages('ipred') library(ipred)

then,you can use library(caret).

Related