[R] party tree coordinates

aelmore aelmore at usgs.gov
Wed Oct 31 18:41:48 CET 2012

I'm hoping that folks out there with expertise in working with the party
package can help me out here.  My team is trying to convert party tree
output into a text file format that can be read by our image processing
software.  We are running into difficulties because the way the two
different programs identify their nodes is different.

R numbers it's nodes 1, 2, 3, 4, 5, 6 etc. down the "yes" answers in the
tree until a terminal node is reached, at which point it backs up to the
parent of that terminal node, gives its "no" child the next number
available, follows any additional yes children down from there until it hits
a terminal node, and repeats necessary.

Our image processing system uses a coordinate system that labels each node
according to its location in the tree (e.g. row 4, column 43).  For
instance, the first split in the tree is at location (1,1), the two daughter
nodes are (2,1) and (2,2), and their daughters are (3,1), (3,2), (3,3),
(3,4), etc. etc. on down the tree.  It assigns these location coordinates
referencing all possible node locations.  In other words, if node (2,1) in
the above scenario happened to be a terminal node, the daughters of node 2,2
would still be labeled (3,3) and (3,4), even though nodes (3,1) and (3,2)
would not actually exist. They are still, from a labeling/ID perspective,
retained, as it were, as phantom place holders.

Given that the plot function in the party package is able to produce output
that shows these column and row relationships in graphical format, it seems
to me that there ought to be a way to extract this positional information
from the package, but I haven't found a way to do it yet.

The plot.tree info in the manual says it creates "an (invisible) list with
components x and y giving the coordinates of the tree nodes," and I'm
wondering if it's talking about "tree coordinates," as used by our image
processor, or if it's refering to the x and y position on the printed plot.
Either way, I don't know how to access those x/y numbers. 

At any rate, I'm pretty stumped.  It seems to me that since the positional
relationships are produced in the plots, there ought to be a way to get at
them, programmatically.

Any suggestions out there?

View this message in context: http://r.789695.n4.nabble.com/party-tree-coordinates-tp4648047.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list