[R] Help with RandomForest

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Mon May 17 15:20:42 CEST 2010

I'm working with the randomForest package and have successfully build a
model.  I'd like to go one step further however, and use the output from
the model to construct a map using the output.  My input data are spatial,
and I have an independent set of rasterize maps for each of the predictor
variables, to map the classification solution.

Using the getTree function:

> getTree(randomForest(veg.physical[,-1], veg.physical[,1], ntree = 20, ),
labelVar = TRUE)

returns a  "list" with dim(tree)  451 rows x 6 columns.

I assume that other folks using this package and publishing maps have used
this list to link the left and right daughters, split variable, and the
split point back to a map.

Here is a brief example( just the first 6 rows)  of that list:
        left daughter right daughter split var        split point
status prediction
1             2                     3           TN                32.665
      1       <NA>
2             4                     5           TN                12.310
       1       <NA>
3             6                     7           BD                0.125
      1       <NA>
4             8                     9     Total_Mg          4218.000
 1       <NA>
5            10               11          LOI               92.475
1       <NA>
6            12               13    Total_Mg          831.000           1

This is where I'm searching for a procedure to accomplish that.  If anyone
has a procedure I would greatly appreciate it if you would share that with


Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147

More information about the R-help mailing list