I am trying to boost my classification tree and was trying to use the gbm package. My variables are character variables of 'N' and 'Y', so the gbm.fit brings an error that my variable "is not of type numeric, ordered, or factor." Is there a way to change how this is read without changing my variable.
Asked
Active
Viewed 650 times
1 Answers
1
No it will only accept a factor. You can wrap your target variable with as.factor(my_target_variable) in the gbm.fit call itself if you don't want to change the dataframe itself.

Jamalan
- 482
- 4
- 15
-
My target variable is wrapped as a factor. It was the other variables in the formula it wasn't accepting. – Joseph Kim Feb 12 '20 at 03:26