[R] partition.tree() version for rpart ?

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 15 12:22:28 CEST 2003


The "tree" package has a nice function partition.tree() for
drawing the (1D or) 2D partition in the case of only (one or)
two predictors  {See the examples in  help(partition.tree)}.
{and so does S-plus (not in a separate package though)}.

It seems to me that there's no function with similar functionality
available for rpart.  Am I mistaken? Has anyone worked on this?

One possible approach might be to provide an  as.tree() function
for "rpart" objects and then use partition.tree() from the
"tree" package.
Given that "rpart" is a recommended R package, I'd rather prefer
to have a `standalone' function working with "rpart" objects.

BTW: an optimal name for that function is not clear:
  partition.tree could be used, since it's a simple function,
  not a "tree" method for a "partition" generic.
  parition.rpart() could be used as well.

But for me, a generic partition() function shouldn't be used to
draw (1- or) 2-partitions.  If generic/method, I'd prefer
a naming scheme something like  plotPart[.(rpart|tree)].

Feedback very welcome.
Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><




More information about the R-help mailing list