Hi Christoph & Gustavo,

Quoting Christoph Heibl <christoph.he...@gmx.net>:
Hi Gustavo,

Hava a look at:

?`%in%`

Given a matrix 's' of class DNAbin and a tree 'tr' of class phylo, you
simply do:

s <- s[-(rownames(s) %in% tr$tip.label), ]

Yes but replace '-' with '!':

s <- s[!(rownames(s) %in% tr$tip.label), ]

'%in%' returns logical values which will be (silently) converted to numeric by '-'. Another possibility is to use match:

s <- s[-match(tr$tip.label, rownames(s), ]

In both cases, you can select the dropped tips instead of deleting them by removing the appropriate operator (! or -).

Of course this requires matching taxon names in s and tr...

That will certainly be the case if the tree has been estimated with R (eg, nj() in ape or pml() in phangorn).

Emmanuel

HTH
Christoph



________________________________________________________

Christoph Heibl

Systematic Botany
Ludwig-Maximilians-Universität München
Menzinger Str. 67
D-80638 München
GERMANY

phone:     +49-(0)89-17861-251
e-mail:    he...@lmu.de

http://www.christophheibl.de/ch-home.html

SAVE PAPER - THINK BEFORE YOU PRINT



On Sep 28, 2009, at 7:43 AM, Gustavo Ybazeta wrote:

Hello,

I am working with a more less a big phylogeny (over 100 taxa). I had used
drop.tips to analyze some clades independently and produce sub-trees. My
question is: how can I use the information in the modified trees to drop the
same taxa in the original DNA matrix? I have been doing this outside of R but
I am sure should be a better way to do this.

Thanks

Gustavo

_______________________________________________
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

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

Reply via email to