post.rpart               package:rpart               R Documentation

_P_o_s_t_S_c_r_i_p_t _P_r_e_s_e_n_t_a_t_i_o_n _P_l_o_t _o_f _a_n _R_p_a_r_t _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     Generates a PostScript presentation plot of an 'rpart' object.

_U_s_a_g_e:

     post(tree, ...)

     ## S3 method for class 'rpart':
     post(tree, title., 
          filename = paste(deparse(substitute(tree)), ".ps", sep = ""), 
          digits = getOption("digits") - 3, pretty = TRUE,
          use.n = TRUE, horizontal = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

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

  title.: a title which appears at the top of the plot.  By default,
          the  name of the 'rpart' endpoint is printed out.  

filename: ASCII file to contain the output.  By default, the name of
          the file is  the name of the object given by 'rpart' (with
          the suffix '.ps' added). If  'filename = ""', the plot
          appears on the current graphical device.  

  digits: number of significant digits to include in numerical data.  

  pretty: an integer denoting the extent to which factor levels will be
           abbreviated in the character strings defining the splits; 
          (0) signifies no abbreviation of levels.  A 'NULL' signifies
          using  elements of letters to represent the different factor
          levels.  The  default ('TRUE') indicates the maximum possible
          abbreviation.  

   use.n: Logical.  If 'TRUE' (default), adds to label  (#events
          level1/ #events level2/etc. for method 'class', 'n' for 
          method 'anova', and #events/n for methods 'poisson' and
          'exp'). 

horizontal: Logical.  If 'TRUE' (default), plot is horizontal. If
          'FALSE', plot  appears as landscape.  

     ...: other arguments to the 'postscript' function.  

_D_e_t_a_i_l_s:

     The plot created uses the functions 'plot.rpart' and 'text.rpart'
     (with  the 'fancy' option).  The settings were chosen because they
     looked  good to us, but other options may be better, depending on
     the 'rpart'  object.    Users are encouraged to write their own
     function containing favorite  options.

_S_i_d_e _E_f_f_e_c_t_s:

     a plot of 'rpart' is created using the 'postscript' driver, or the
     current device if 'filename = ""'.

_S_e_e _A_l_s_o:

     'plot.rpart',  'rpart',  'text.rpart',  'abbreviate'

_E_x_a_m_p_l_e_s:

     data(car.test.frame)
     z.auto <- rpart(Mileage ~ Weight, car.test.frame)
     post(z.auto, file = "")   # display tree on active device
        # now construct postscript version on file "pretty.ps"
        # with no title
     post(z.auto, file = "pretty.ps", title = " ")
     z.hp <- rpart(Mileage ~ Weight + HP, car.test.frame)
     post(z.hp)

