I'm baffled. I've used train before with no problem. But now I'm repeatedly getting the "unused arguments" error.
#Generate random data
y <- rnorm(100, mean=.5)
x <- rnorm(100)
data <- cbind(x, y)
form <- y ~ x
fitControl <- trainControl(## 10-fold CV
method = "cv",
number = 8)
set.seed(825)
lmFit1 <- train(x, y, method = "lm", trControl = fitControl, na.action=na.omit)
lmFit1 <- train(form, data = data, method = "lm", trControl = fitControl, na.action=na.omit)
Since I am running a linear regression, I've specified this model both with x and y, and with form. Both generate the same error.
Error in train(form, method = "lm", trControl = fitControl, na.action = na.omit) : unused arguments (method = "lm", trControl = fitControl, na.action = na.omit)
Error in train(x, y, method = "lm", trControl = fitControl, na.action = na.omit) : unused arguments (y, method = "lm", trControl = fitControl, na.action = na.omit)
In my actual data, I have many more predictors, and have played around with only including 1 or 2 predictors at a time, but all generate the same error. Even the random data generates the error.
Any thoughts? Help is much appreciated! Thanks!
train
function after you loadedcaret
, and that othertrain
function is maskingcaret
'strain
function? – eipi10