Phil
Phil

Reputation: 31

Caret library fails to load

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?

Upvotes: 2

Views: 14597

Answers (4)

Ledx
Ledx

Reputation: 31

First use this:

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

then,you can use library(caret).

Upvotes: -1

vikram singh
vikram singh

Reputation: 61

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

Upvotes: 0

Phil
Phil

Reputation: 31

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

Upvotes: 0

Vasco
Vasco

Reputation: 911

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.

Upvotes: 1

Related Questions