Bharat
Bharat

Reputation: 31

R - error installing caret package

> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()),
> versionCheck = vI[[j]]) :    namespace ‘pbkrtest’ 0.4-2 is being
> loaded, but >= 0.4.4 is required  
> Error: package or namespace load
> failed for ‘caret’

Caret was working fine until I tried to load Rcpp and it messed everything up.

I searched the answers for a similar problem with caret but the solutions posted did not seem to work on mine. I followed:

install.packages("caret", dependencies = TRUE) 

But it did not work.

Upvotes: 3

Views: 31641

Answers (9)

Anush B M
Anush B M

Reputation: 11

Try

install.packages('DEoptimR') 

and followed by

install.packages("caret", dependencies = TRUE)

I had the same issues. Both of these commands worked for me.

Upvotes: 1

Amol P Suryavanshi
Amol P Suryavanshi

Reputation: 131

I would suggest you to check the R version. I updated the version to 3.5.1 and it works perfectly :)

Mac only – use updateR

Similar to installr, updateR is the package to help updating R on Mac OS.

The R code you will need are the following 5 lines:

install.packages('devtools') #assuming it is not already installed

library(devtools)

install_github('andreacirilloac/updateR')

library(updateR)

updateR(admin_password = 'Admin user password')

Upvotes: 6

user13367096
user13367096

Reputation: 1

Use this:

install.packages(c("ggplot2", "lattice", "lava", "purrr", "caret"))
library(c("ggplot2", "lattice", "lava", "purrr", "caret"))

If that doesn't work, create a folder (R_LIB in this case) on your computer (documents in this case) and include the folder location as follow:

install.packages(c("ggplot2", "lattice", "lava", "purrr", "caret"), lib = "C:/documents/R_LIB")    
library(c("ggplot2", "lattice", "lava", "purrr", "caret"), lib = "C:/documents/R_LIB")

Upvotes: 0

I'm in R 3.6.1 and got the same error today.

I used this code:

install.packages("caret",dep = TRUE)
install.packages("ggplot2")
install.packages("lattice")
install.packages("lava")
install.packages("purrr")

library(ggplot2)
library(lattice)
library(lava)
library(purrr)
library(caret)

And now it works fine for me. It's all about dependencies that you should install with caret.

Upvotes: 0

Asef Daqiq
Asef Daqiq

Reputation: 1

I did try all the above mentioned ways to install and activate caret but none worked for me. finally what I did was to go to my drive location where R libraries are located. I removed a folder called "caret" and then in R studio I run "remove.packeges("caret")" to remove the caret package. then I reinstalled the package. install.packages("caret") library(caret) it worked for me.

Upvotes: 0

Kushwaha
Kushwaha

Reputation: 918

I have faced this issue and tried many ways but followed r console about error thrown and started downloading packages one by one. steps noted down what i did for this. y r studio version is "R version 3.4.4"

First install.packages("caret"), install.packages("ggplot2"), install.packages("lattice"), install.packages("lava")..

then load library(ggplot2) then library(lattice) then library(lava) and then finally library(caret).

What i believe that caret have these packages dependency so once caret is installed ideally 'install.packages('caret', dependencies = TRUE)' should work but it was not working in my R version so i did the step as given above and it worked for me.

hope it may work if someone get this issue

Upvotes: 0

pmjn6
pmjn6

Reputation: 307

I faced the same error with caret and none of the above suggestions helped. My R version was 3.2 and current version is 3.4. I installed the new version and the issue was resolved

Upvotes: 0

raha.rah
raha.rah

Reputation: 428

I also faced the same problem with caret package and I could solve it as the following:

install.packages("lme4", dependencies = TRUE)
library(lme4)
methods(sigma)
install.packages("pbkrtest", dependencies = TRUE)
library(caret)

This worked for me!

Upvotes: 1

A_Guest
A_Guest

Reputation: 11

I have the same problem with my dynlm package. I get the same error. But as R states pbkrtest is required. This package isn't available under R 3.2.3. However you can download the package online, look a bit further on this site, the question is already asked on stackoverflow and they gave a site where you can find the packages. Then write the following code:

install.packages("...",repos = NULL, type="source")
install.packages("pbkrtest", dependencies = TRUE) 

In the first line, here I wrote the 3 dots you need to write the path to the file where you placed the pbkrtest-package.

Upvotes: 1

Related Questions