In R, how does one create an xgb.DMatrix object from an R data frame?
Welcome to the site!
y is your response, and
x is your data set of predictors (where categorical variables have been appropriately converted to numeric). Your data does not necessarily need to be sparse, although sparse data will improve computation speed.
dtrain <- xgb.DMatrix(label = y, data = as.matrix(x)).
As you get more proficient with XGBoost you can start exploring the
The short answer is that you can't do this directly. You have to start off with a sparse matrix or a libsvm file. See the discussion at https://goo.gl/kiHCqk for getting from a data frame to libsvm.