R - XGBoost: Error building DMatrix R - XGBoost: Error building DMatrix r r

R - XGBoost: Error building DMatrix


Just convert data frame to matrix first using as.matrix() and then pass to xgb.Dmatrix().


Check if all columns have numeric data in them- I think this could be because you have some column that has data stored as factors/ characters which it won't be able to convert to a matrix. if you have factor variables, you can use one-hot encoding to convert them into dummy variables.


"As you can see, they are both DataFrames." -Gabriel Chaves Becchi

A data frame is just a list of vectors. Might be why you're seeing "list".