[R] categorical variables

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Apr 14 18:30:50 CEST 2003


On Mon, 14 Apr 2003, Luis Silva wrote:

> I want to fit an rpart model (regression tree). I transformed 
> those variables to factors already and it worked. The problem 
> is that when I plot the tree the categorical variables came 
> like Emissor=acde, that I suppose it is a code for the numbers 
> 1,3,4,5. I think I can force R to plot Emissor=1345 or 
> something like that

?text.rpart says

  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. 

so the answer is right there on the help page.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list