Getting the error message:
Error in predict.randomForest(titanic.rf.model, newdata = titanic.test2) :
Type of predictors in new data do not match that of the training data.
This is happening because of different number of levels in some factor variable in your test and train dataset. You can remove the error by finding the variable and using the following code:
levels(test$variableName) <- levels(train$variableName)