I am having some problems in R. Below is my code. It worked fine until recently and now i get the error:
Error in list(test_drive_enquiries, TV.spend, Display.spend, Social.spend) : invalid 'envir' argument
Here is my code:
library(caret)
# Data partition ----------------------------------------------------------
set.seed(222)
ind<-sample(2,nrow(mtcars), replace=T, prob=c(0.7,0.3))
train<-mtcars[ind==1,]
test<-mtcars[ind==2,]
# Custom control parameters for Machine Learning -----------------------------------------------
#
custom<-trainControl(method="repeatedcv",
number=10,
repeats=5,
verboseIter = T)
###Models
set.seed(1234)
model<-train(mpg~wt+qsec,
train,
method='lm',
trControl=custom)
summary(model$finalModel)
The error occurs at the model building stage. This same error also occurs if I open a different Rmarkdown document which has a different dataset, with a different regression model.
Also, I can't seem to clear the environment with rm(list=ls())
I get the following error: Error in rm(list = ls()) : unused argument (list = ls())