So I am attempting to generate a model in R using gbm.fit() from the gbm package. However, when trying to run:
model <- gbm.fit(x = as.matrix(predictors), y = response, distribution = "bernoulli", n.trees = 100, interaction.depth = 4, shrinkage = 0.01)
I receive the following error:
Error in gbm.fit(x = as.matrix(predictors), y = response, distribution = "bernoulli", : variable 1: x03 is not of type numeric, ordered, or factor.
All of my variables are binary in nature (categorical with 2 levels, 0 and 1), and I was sure to convert all of my variables to factors via
data <- mutate_if(data, is.numeric, as.factor)
And even after manually checking the class of each of the variables to ensure that they are factors, I continue to receive the same error. I honestly have no idea what could be causing the problem here.