I am running an XGboost function in R. I prepare several variables by transforming first into factors (e.g. day of month). I then transform by using a sparse model matrix and