caret is not seeing my data

I am new to caret. As you can see by attached snapshot variables y and x1-x6 are in dataset df. y is a binary response variable. What is this error trying to tell me? The variables are there but caret does not recognize them.

See the FAQ: How to do a minimal reproducible example reprex for beginners, because it's seldom possible to make out what's happening with a screenshot. It this one says what I think it does, you need to check that your variable names as "legal", with no embedded spaces, no non-printing characters, emojis, initial numerals or punctuation.

reference to x1-x6 works everywhere else in the program which is long with lots of preprocessing before running this code.

I tried something else that worked

train(as.factor(y) ~ x1+x2+x3+x4+x5+x6,df,method="rf")

I sometimes miss fact that I either specify all parameters with an equal sign or not as I have done here.

Thanks for the reply.

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.