addXlevels {yaImpute}R Documentation

Adds xlevels to randomForest objects

Description

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.

Usage

addXlevels(object,origDataFrame)

Arguments

object an object built by randomForest
origDataFrame the data frame used in the randomForest fit.

Value

An object of class randomForest with xlevels appended.

Author(s)

Nicholas L. Crookston ncrookston@fs.fed.us
Andrew O. Finley finleya@msu.edu

See Also

yai and AsciiGridPredict

Examples


if (require(randomForest))
{
  data(iris)
  rf = randomForest(x=iris[,2:5],y=iris[,1])
  new = addXlevels(rf,iris)
  print(new$xlevels)
  predict(new)
}

[Package yaImpute version 1.0-8 Index]