Dear Liam (and the others that responded directly to my email), I tested the provided code and it works beautifully. Thanks!
Any suggestions about the second problem I indicated in the original email? Thanks! Susan On Mon, Nov 3, 2014 at 1:36 PM, Liam J. Revell <liam.rev...@umb.edu> wrote: > You could try something like the following: > > tips<-tree$tip.label > genera<-unique(sapply(strsplit(tips,"_"),function(x) x[1])) > ii<-sapply(genera,function(x,y) grep(x,y)[1],y=tips) > tree<-drop.tip(tree,setdiff(tree$tip.label,tips[ii])) > > Let us know if this works. > > All the best, Liam > > Liam J. Revell, Assistant Professor of Biology > University of Massachusetts Boston > web: http://faculty.umb.edu/liam.revell/ > email: liam.rev...@umb.edu > blog: http://blog.phytools.org > > > On 11/3/2014 11:56 AM, Susan Kapust wrote: > >> Dear colleagues, >> >> I have a large species-level phylogeny in which the tip labels are >> indicated as "Genus_species". All genera are monophyletic. >> >> I have two things I'm struggling with: >> >> (1) I'd like to drop all but one of the tips in each genus (i.e. to >> generate a genus-level phylogeny). Given that all genera are >> monophyletic, it shouldn't matter which species I pick. >> >> (2) I'd like to establish an era (e.g. 25 Mya) and leave only one >> representative of the clades there were present at that point in time. >> >> Given that I actually have a post-burnin set of trees, once I figure out >> how to do the steps above I could (hopefully) do that for all trees. >> >> thanks so much for your help. >> >> Susan. >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> 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-ph...@r-project.org/ >> >> [[alternative HTML version deleted]] _______________________________________________ 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/