Xgb.importance() unable to plot sparse.model.matrix()!

r
hackathon
error
xgboost
big_mart_sales

#1

Hi,
After successfully building XGBoost model on sparse.model.matrix(~.-1, data=train_set)
I get below error on the R console while attempting to plot feature importance matrix :

Error in readLines(filename_dump) : ‘con’ is not a connection

Code:
names_ <- train_matrix@Dimnames[[2]]
xgb.importance(names_ , model=xg_mod)

If you had experienced this issue, how did you resolve it ? Is it because I had applied one hot encoding using ‘sparse.model.matrix’ ?