Hi Lev,
After reading the tree:
alllabels <- c(tree$tip.label, tree$node.label)
will give you a vector of labels matching the integers in tree$edge. So
you may do something like:
parent <- alllabels[tree$edge[, 1]]
child <- alllabels[tree$edge[, 2]]
cbind(parent, child)
Best,
Emmanuel
Le 13/01/2016 01:54, Yampolsky, Lev a écrit :
A very simple question: I have a tree with all tips and nodes labeled
and I want parent-child pairs from it. Looking at tree$edge does not
quite help, because these parent and child pairs are labeled by the
internal index, not IDs from the newick file. Looking at tree$tip.label
and tree$node.label does not help, because these two vectors index tips
and nodes separately, so these indexes do not correspond to those in
tree$edge.
Should be very very obvious how to do it!
Thanks!
--
Lev Yampolsky
Professor
Department of Biological Sciences
East Tennessee State University
Box 70703
Johnson City TN 37614-1710
Cell 423-676-7489
Office/lab 423-439-4359
Fax 423-439-5958
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Pour nous remonter une erreur de filtrage, veuillez vous rendre ici :
http://f.security-mail.net/307Qn7dFem8
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/