text.rpart               package:rpart               R Documentation

_P_l_a_c_e _T_e_x_t _o_n _a _D_e_n_d_r_o_g_r_a_m

_D_e_s_c_r_i_p_t_i_o_n:

     Labels the current plot of the tree dendrogram with text.

_U_s_a_g_e:

     ## S3 method for class 'rpart':
     text(x, splits=TRUE, label="yval", FUN=text, all=FALSE,
          pretty=NULL, digits=getOption("digits") - 3, use.n=FALSE,
          fancy=FALSE, fwidth=0.8, fheight=0.8, ...)

_A_r_g_u_m_e_n_t_s:

       x: 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. 

  splits: logical flag.  If 'TRUE' (default), then the splits in the
          tree are labeled with the criterion for the split. 

   label: a column name of 'x$frame';  values of this will label the
          nodes.  For the '"class"' method, 'label="yval"' results in
          the factor levels being used, '"yprob"' results in the
          probability of the winning factor level being used, and
          'specific yval level' results in the probability of that
          factor level.    

     FUN: the name of a labeling function, e.g. 'text'.   

     all: Logical.  If 'TRUE', all nodes are labeled, otherwise just
          terminal nodes. 

  pretty: an integer denoting the extent to which factor levels in
          split labels will be abbreviated.  A value of (0) signifies
          no abbreviation.  A 'NULL', the default, signifies using
          elements of letters to represent the different factor levels. 

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

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

   fancy: Logical.  If 'TRUE', nodes are represented by ellipses
          (interior nodes) and rectangles (leaves) and labeled by
          'yval'.  The edges connecting the nodes are labeled by left
          and right splits. 

  fwidth: Relates to option 'fancy' and the width of the ellipses and
          rectangles. If 'fwidth < 1' then it is a scaling factor
          (default = 0.8).  If  'fwidth > 1' then it representes the
          number of character widths  (for current graphical device) to
          use. 

 fheight: Relates to option 'fancy' and the height of the ellipses and
          rectangles. If 'fheight <1' then it is a scaling factor
          (default = 0.8).  If 'fheight > 1' then it represents the
          number of character heights  (for current graphical device)
          to use. 

     ...: Graphical parameters may also be supplied as arguments to
          this function (see 'par'). 

_S_i_d_e _E_f_f_e_c_t_s:

     the current plot of a tree dendrogram is labeled.

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_s:

     data(freeny)
     freen.tr <- rpart(y ~ ., freeny)
     plot(freen.tr)
     text(freen.tr, use.n=TRUE, all=TRUE)

