I want to combine my test and the training datasets so that I can create new variables in both of them together. I use the command
but get and error saying
Error in rbind(deparse.level, …) :
numbers of columns of arguments do not match
So I create dummy variables which are missing in the test dataset and then use the same command again but get an error saying that the order of variables are different.
This problem does not arise while combining datasets in python as it takes NaNs in place of the missing variables and combines them. Can we not do something similar in R? Or the only way is to create the same variables in the same order in both the datasets and then combine them?