[R-sig-phylo] Convert filogenetic tree to binary matrix

2011-04-28 Thread Vanderlei Debastiani
Good morning! I need to create a binary matrix with all node of a phylogenetic tree and the presence of each taxo in their respective node. Example: require(ape) y-read.tree(text=(E,((H,I)D,(F,G)C)B)A;) y plot(y, show.node=TRUE) I need to create a binary matrix as follows: A

Re: [R-sig-phylo] Convert filogenetic tree to binary matrix

2011-04-28 Thread Liam J. Revell
Hi Vanderlei, Try this which uses ape function prop.part(): temp-prop.part(tree) X-matrix(0,nrow=length(tree$tip),ncol=length(temp),dimnames=list(tree$tip.label,tree$node.label)) for(i in 1:ncol(X)) X[temp[[i]],i]-1 - Liam -- Liam J. Revell University of Massachusetts Boston web: