XGBoost: Can the features in test data be a subset of the features used to train the model? Is it a problem if the test data only has a subset of the features that are used to train the xgboost model? All my predictor variables (except 1) are factors, so one hot encoding is done before converting it into xgb.DMatrix. So the different levels of the factor variables become the features and my test doesn't have all of these features, only a subset of it. 

At the moment, while running my model on test data in R, I 'm running into an error saying that "Features names stored in object and newdata are different!". 

I'm new in the field, so any help would be much appreciated. Thanks!
All the variables used to train the model must be present in the test set.

This is because you used all the variables to create the rules. Hence we would need those to score them.

If you are using python to do one hot encoding using fit or fit_transform functions in sklearn you will use the same object to transform the test set using transform function.

This will ensure the variables to be consistent in test and train.