Error while using caret library

Hello,
While using the caret package, I get an error. PLease see below

> library(kernlab)
> library(caret)

Error: package or namespace load failed for ‘caret’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘recipes’
In addition: Warning message:
package ‘caret’ was built under R version 4.0.5

Thank you

This is asking you to install the recipes package

install.packages("recipes")

Do you get any error message while doing so?

Yes. I did install the package "recipes", but I still get the same error. I did use -install.packages("caret") fromt he RStudio console and the install packages feature from RStudio, is there may be another source for package installation?

I have also tried:

install.packages("caret", dependencies = T) and still get the same error.

I also tried

install.packages(pkgs = "caret", 
             dependencies = c("Depends", "Imports"))

but it does not solve the problem

If you keep getting the same error message then you haven't installed recipes successfully, please post the complete console output you get when you try to install recipes

Please see recipes package installation output below:
"
R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Workspace loaded from ~/.RData]

install.packages("recipes")
Installing package into ‘C:/Users/giuse/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependency ‘rlang’

trying URL 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.0/rlang_1.0.4.zip'
Content type 'binary/octet-stream' length 2062417 bytes (2.0 MB)
downloaded 2.0 MB

trying URL 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.0/recipes_1.0.1.zip'
Content type 'binary/octet-stream' length 1704607 bytes (1.6 MB)
downloaded 1.6 MB

package ‘rlang’ successfully unpacked and MD5 sums checked
package ‘recipes’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\giuse\AppData\Local\Temp\RtmpI1IMlE\downloaded_packages"

After installing recipes, when I try to run the code below:

data(spam)

inTrain <- createDataPartition(y = spam$type, p = 0.75, list = FALSE)
training <- spam[inTrain,]
testing <- spam[-inTrain,]
dim(training)

the program halts execution

When I run aportion of the code:


library(caret)
library(kernlab)


data(spam)

inTrain <- createDataPartition(y = spam$type, p = 0.75, list = FALSE)

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Workspace loaded from ~/.RData]

source("~/DataScience/RSCRIPTS/MACHINE LEARNING/caretpackage.R", echo=TRUE)

library(caret)
Loading required package: ggplot2
Loading required package: lattice

library(kernlab)

Attaching package: ‘kernlab’

The following object is masked from ‘package:ggplot2’:

alpha

data(spam)

#inTrain <- createDataPartition(y = spam$type, p = 0.75, list = FALSE)
#training <- spam[inTrain,]
#testing <- spam[-inTrain,]
#dim(training)
.... [TRUNCATED]
Warning messages:
1: package ‘caret’ was built under R version 4.0.5
2: package ‘ggplot2’ was built under R version 4.0.5
3: package ‘kernlab’ was built under R version 4.0.5
library(caret)
library(kernlab)

data(spam)
source("~/DataScience/RSCRIPTS/MACHINE LEARNING/caretpackage.R", echo=TRUE)

library(caret)

library(kernlab)

data(spam)

inTrain <- createDataPartition(y = spam$type, p = 0.75, list = FALSE)
Error in split_indices(as.integer(splitv), attr(splitv, "n")) :
function 'Rcpp_precious_remove' not provided by package 'Rcpp'I get the error below:

The problem was solved by installing package update from RStudio Tools --> Check for updatesd.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.