[R] dendrogram and dendrapply

Martin Olivier martinol at ensam.inra.fr
Wed May 18 10:15:57 CEST 2005


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.




More information about the R-help mailing list