Hi Ben. Take a look at the function findMRCA in my package, phytools. I think this does what you want.
Good luck. 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 -----Original Message----- From: Ben Weinstein Sent: Wednesday, August 15, 2012 9:38 AM To: r-sig-phylo@r-project.org Cc: Shea Lambert; Antonin Machac Subject: [R-sig-phylo] find mrca of multiple taxa. Hello all, I'm trying to replace a clade of tips with a single tip, placed at the mrca of all taxa clade (similar Q to here https://stat.ethz.ch/pipermail/r-sig-phylo/2012-March/001895.html). Before i bind tree, I just need to a nice way to identify which node encompasses all descendants. I see many packages and functions, but i can't quite get the result i want. Forgive me if i've just missed this function somewhere, it seems hard to believe it hasn't been written explicitly. Clearly the package phylobase knows which node i want, when i subset by the tips.include library(phylobase) data(geospiza) nodeLabels(geospiza) <- paste("N", nodeId(geospiza, "internal"), sep="") geotree <- extractTree(geospiza) ## "subset" examples tips <- c("difficilis", "fortis", "fuliginosa", "fusca", "olivacea", "pallida", "parvulus", "scandens") subset(geotree, tips.include=tips) How can i get it to return which node it used, numbered from the original tree? My other attempt was to use expand.grid and mrca through an sapply command to brute force walk through every pair of taxa, and then take the maximum node number (since its farthest up the tree). This seems inelegant, and i'm not convinced it works 100% of the time. Thanks for your input. Ben Weinstein -- Ben Weinstein Graduate Student Ecology and Evolution Stony Brook University http://life.bio.sunysb.edu/~bweinste/index.html [[alternative HTML version deleted]] _______________________________________________ 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