My question is related to this one regarding categorical data (factors in R terms) when using the Caret package. I understand from the linked post that if you use the "formula interface", some features can be factors and the training will work fine. My question is how can I scale the data with the preProcess()
function? If I try and do it on a data frame with some columns as factors, I get this error message:
Error in preProcess.default(etitanic, method = c("center", "scale")) :
all columns of x must be numeric
See here some sample code:
library(earth)
data(etitanic)
a <- preProcess(etitanic, method=c("center", "scale"))
b <- predict(etitanic, a)
Thank you.
See Question&Answers more detail:os