I generate a tree use rpart. In the node of tree, split is based on the some factor. I want to label these node based on the levels of this factor. Does anyone know how to do this? Thanks, Aimin
not sure how you want to label it. could you be more specific? thanks. On 2/14/07, Aimin Yan <aiminy at iastate.edu> wrote:> I generate a tree use rpart. > In the node of tree, split is based on the some factor. > I want to label these node based on the levels of this factor. > > Does anyone know how to do this? > > Thanks, > > Aimin > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- WenSui Liu A lousy statistician who happens to know a little programming (http://spaces.msn.com/statcompute/blog)
> levels(training$aa_one)[1] "A" "C" "D" "E" "F" "H" "I" "K" "L" "M" "N" "P" "Q" "R" "S" "T" "V" "W" "Y" this is 19 levels of aa_one. When I see tree, in one node, it is labeled by aa_one=bcdfgknop it is obvious that it is labeled by alphabet letter ,not by levels of aa_one. I want to get aa_one=CDE...... such like. Do you know how to do this Aimin At 04:23 PM 2/14/2007, Wensui Liu wrote:>not sure how you want to label it. >could you be more specific? >thanks. > >On 2/14/07, Aimin Yan <aiminy at iastate.edu> wrote: >>I generate a tree use rpart. >>In the node of tree, split is based on the some factor. >>I want to label these node based on the levels of this factor. >> >>Does anyone know how to do this? >> >>Thanks, >> >>Aimin >> >>______________________________________________ >>R-help at stat.math.ethz.ch mailing list >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code. > > >-- >WenSui Liu >A lousy statistician who happens to know a little programming >(http://spaces.msn.com/statcompute/blog)
Try the following to see: library(rpart) iris.rp(Sepal.Length ~ Species, iris) plot(iris.rp) text(iris.rp) Two possible solutions: 1. Use text(..., pretty=0). See ?text.rpart. 2. Use post(..., filename=""). Andy From: Wensui Liu> > not sure how you want to label it. > could you be more specific? > thanks. > > On 2/14/07, Aimin Yan <aiminy at iastate.edu> wrote: > > I generate a tree use rpart. > > In the node of tree, split is based on the some factor. > > I want to label these node based on the levels of this factor. > > > > Does anyone know how to do this? > > > > Thanks, > > > > Aimin > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > -- > WenSui Liu > A lousy statistician who happens to know a little programming > (http://spaces.msn.com/statcompute/blog) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > >------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}