I ran a random forest on a training data set (60% of the parent data set).
I used the "predict" function in R to evaluate how well the model performs on the test data set (40% of the parent data set)
I used
require(randomForest)
trained_model <- randomForest(y~.,data = training,
importance=TRUE,
keep.forest=TRUE)
result <- predict(trained_model, type = response, newdata=testing[-17])
removed 17th column since it's "y"
The problem is that the "result" is an array, this there a way to add this predicted value back into the testing data set as a new column
Something like
Id x1 x2 ...... Xn y predicted
1 0.1 0.12 23 no no