| addXlevels {yaImpute} | R Documentation |
This function adds xlevels (see lm) to
randomForest objects. Function
AsciiGridImpute will check the levels on the input
maps to insure that only those used in the fitting are used in the predictions.
Note that this function is not needed for objects built using randomForest version 4.5-21 or later.
addXlevels(object,origDataFrame)
object |
an object built by randomForest |
origDataFrame |
the data frame used in the randomForest fit. |
An object of class randomForest with xlevels appended.
Nicholas L. Crookston ncrookston@fs.fed.us
Andrew O. Finley finleya@msu.edu
yai and AsciiGridPredict
if (require(randomForest))
{
data(iris)
rf = randomForest(x=iris[,2:5],y=iris[,1])
new = addXlevels(rf,iris)
print(new$xlevels)
predict(new)
}