Hi there, I am growing classification trees using the 'tree' package add-on to R. I would like to convert the 'R' output to the SAS format used by Salford Systems' commercial CART software in order to interface with some other software. My question is: How can I parse the R tree data structure in order to infer the tree structure? The 'tree' class has a member '$frame' which gives the splits at each node, but as far as I can see does not specify the daughter nodes. Is this information accessible through the interface to class 'tree' or do I need to dive into the C code? Alternatively, is there an existing add-on which does this? I gather functions exist to read SAS code but I haven't seen anything which writes it. Thanks in advance, Maria
On Tue, 18 Oct 2005, Hades wrote:> Hi there, > > I am growing classification trees using the 'tree' package add-on to R. > > I would like to convert the 'R' output to the SAS format used by Salford Systems' commercial CART software in order to interface with some > other software. > > My question is:> How can I parse the R tree data structure in order to infer the tree > structure? The 'tree' class has a member '$frame' which gives the > splits at each node, but as far as I can see does not specify the > daughter nodes. Is this information accessible through the interface to > class 'tree' or do I need to dive into the C code?The daughter nodes of n are 2n and 2n+1. The print method, print.tree, is written entirely in R and shows you how to parse the tree (and you can see the pattern of the numbers from its result). -- 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
That's most helpful. Thank you very much for your time.
Best regards,
Maria
On Tue Oct 18 17:18 , Prof Brian Ripley <ripley at stats.ox.ac.uk>
se nt:
On Tue, 18 Oct 2005, > Hi there,
>
> I am growing classification trees using the 'tree' p
add-on to R.
>
> I would like to convert the 'R' output to the SAS fo by
Salford Systems' commercial CART software in order to interfac e with
some
> other software.
>
> My question is:
> How can I parse the R tree data structure in order t tree
> structure? The 'tree' class has a member '$frame' wh
the
> splits at each node, but as far as I can see does no the
> daughter nodes. Is this information accessible throu
interface to
> class 'tree' or do I need to dive into the C code?
The daughter nodes of n are 2n and 2n+1. The print method,
print.tree, is < parse the tree (and you can see the pattern
of the numbers from its result).
--
Brian D. Ripley, [1]ripley at stats.ox.ac.uk
Professor of Applied Statistics, [2]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
References
1. 3D"javascript:top.opencompose('ripley at stats.ox.ac. 2.
file://localhost/tmp/3D"parse.pl?redirect=http%3A%2F%