I am trying to run the caret::train function in a code with variable x values. see below for details
I am using the train function as is here below ↓
model <- train(GenCSTempMax ~., #************************ ENTER THE out.x VALUE
data=genbrg.data,
method="glm",
preProcess="scale",
trControl=control)
what I want to do is have the x variable (above would be GenCSTempMax ) be inputted from a character variable
example
out.x <- "Test"
model <- train("insert out.x here" ~., #************************ ENTER THE out.x VALUE
data=genbrg.data,
method="glm",
preProcess="scale",
trControl=control)
I have tried to use
paste(out.x) & paste0(out.x)
Also have tried to use the infuser package
this is the normal error I get:
Error in model.frame.default(form = names(genbrg.data[, 1]) ~ ., data = genbrg.data, :
variable lengths differ (found for 'GenCSTempMax')
Error in model.frame.default(form = paste(out.x) ~ ., data = genbrg.data, :
variable lengths differ (found for 'GenCSTempMax')
Error in model.frame.default(form = paste0(out.x) ~ ., data = genbrg.data, :
variable lengths differ (found for 'GenCSTempMax')