I was wondering if it is possible to use the caret package with non numerical data.
I know, for example, if I want to use a simple linear regression lm I could have a factor variable for classification.
However, caret blows up if I attempt this. I'm also following the step outlined here The caret Package: A Unifed Interface for Predictive
Models
for illustration I'm attempting to run stepDurationlm <- train (x= trainDescr, y=trainClass, method="lm")
on
str(trainDescr)
'data.frame': 589235 obs. of 2 variables:
$ Anon.Student.Id : Factor w/ 574 levels "02i5jCrfQK","02ZjVTxC34",..: 7 7 7 7 7 7 7 7 7 7 ...
$ Step.Duration..sec.: num 5 5 5 4 5 5 5 5 4 4 ...
I get
Error in train.default(x = trainDescr, y = trainClass, method = "lm") :
All predictors must be numeric for this model. Use the formula interface: train(formula, data)
alternatively, could anyone explain how to have a test set for model performance in R? That's what's motivating me to get caret working.