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: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://phytools.blogspot.com

On 4/28/2011 2:21 PM, Vanderlei Debastiani wrote:
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        B      C        D
G       1       1       1       0
F       1       1       1       0
I       1       1       0       1
H       1       1       0       1
E       1       0       0       0

Somebody could help me to solve this problem.

Thanks,

Vanderlei Debastiani
Laboratório de Ecologia Filogenética e Funcional
Programa de Pós-Graduação em Ecologia
Universidade Federal do Rio Grande do Sul
www.ufrgs.br/leff

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to