[R] dendrogram and dendrapply

From: Martin Olivier <martinol_at_ensam.inra.fr>
Date: Wed 18 May 2005 - 18:15:57 EST


Hi all,

I think I have some problems to use correctly the function dendrapply. Let suppose dend is a dendrogram object. I would likde to know the cardinal number of leaves depending of each node of the tree dend.

It is right that the command attr(dend,"members") gives the total number of leaves, and
attr(dend[[1]],"members") gives the number of leaves for the first left node and so on...

Now to obtain the number of leaves for each node, I tried the function dendrapply :
dendrapply(dend, function(x){attr(x,"members")})

but this command does not give me the result I serach. Could you help me.

Best regards,
Olivier.



R-help@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 Received on Wed May 18 18:22:07 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:50 EST