Print a Tree Object

DESCRIPTION:

This function prints a tree object. It is a method for the generic function print of class tree.

USAGE:

print.tree(x, pretty = F, spaces = 2,  
           digits = .Options$digits-3, ...) 

REQUIRED ARGUMENTS:

x
fitted model object of class tree. This is assumed to be the result of some function that produces an object with the same named components as that returned by the tree function.

OPTIONAL ARGUMENTS:

pretty
a logical or NULL denoting the extent to which factor levels in split labels will be abbreviated. a value of FALSE signifies no abbreviation. A NULL signifies using elements of letters to represent the different factor levels.
spaces
the number of spaces to indent nodes of increasing depth.
digits
the number of digits of numbers to print.

SIDE EFFECTS:

a semi-graphical layout of the contents of x$frame. Indentation is used to convey the tree topology. Information for each node includes the node number, split, size, deviance, and fitted value. This function also prints degenerate trees of class singlenode .

DETAILS:

This function is a method for the generic function for class tree. It can be invoked by calling for an object x of the appropriate class, or directly by calling regardless of the class of the object.

SEE ALSO:

, .

EXAMPLES:

z.auto <- tree(Mileage ~ Weight, car.test.frame) 
z.auto 
# Gives the following output: 
node), split, n, deviance, yval 
      * denotes terminal node 
 1) root 60 1355.000 24.58   
   2) Weight<2567.5 15  186.900 30.93   
     4) Weight<2280 6   16.000 34.00 * 
     5) Weight>2280 9   76.890 28.89 * 
   3) Weight>2567.5 45  361.200 22.47   
     6) Weight<3087.5 23  117.700 24.43   
      12) Weight<2747.5 8   39.880 25.62 * 
      13) Weight>2747.5 15   60.400 23.80   
        26) Weight<2882.5 6   19.330 23.33 * 
        27) Weight>2882.5 9   38.890 24.11 * 
     7) Weight>3087.5 22   61.320 20.41   
      14) Weight<3637.5 16   32.940 21.06   
        28) Weight<3322.5 10   16.500 20.50   
          56) Weight<3197.5 5   11.200 20.60 * 
          57) Weight>3197.5 5    5.200 20.40 * 
        29) Weight>3322.5 6    8.000 22.00 * 
      15) Weight>3637.5 6    3.333 18.67 *