XGBoost (R Interface) throwing "label set cannot be empty" error I am trying to use the XGBoost model to perform a multi-class classification over 40 classes. 

The code is as follows: 

xgb_params = list(colsample_bytree= 0.7,
                  subsample = 0.7,
                  eta = 0.05,
                  objective= 'multi:softmax',
                  max_depth= 5,
                  min_child_weight= 1,
                  eval_metric= "mlogloss", num_class = categoryclassnos,
                  nthread=4)

fit.xgb = xgb.train(params = xgb_params,
                    data = dtrain,
                    nrounds = 500,
                    watchlist = list(train = dtrain, test=dtest),
                    print_every_n = 50)


However, I am getting the following error:


  Check failed: (info.labels.size()) != (0) label set cannot be empty


I have reproduced the dataset and the R script here.

Any help/ pointers are deeply appreciated.
In python I needed to set the label param in  dtrain = xgb.DMatrix(X_train,label=y_train,feature_names=cfg_col_X)

PS I was going to comment but missing rep points.