Hello


This Elaine.



I tried to prune a phylogeny tree using two methods based on the code
attached.



Method 1 returned the tip.label sharing between birddata and birdtree.

Method 2 returned nothing.



Please kindly indicate why Method 2 failed to prune the tree.

Also, please kindly explain the command “birdtree$tip.label[-na.omit”



Thank you again.



Code

Method 1

Library(ape)

birddata <- read.csv("H:/ birddata_family_20130405.csv", header = TRUE)

birdtree <- read.nexus("H:/ birddata_family_20130405.nexus")

setwd("H:)



## prune the phylogeny to include only species which are in the data set

species.to.keep<-read.csv("H:/ birddata_family_20130405.csv", header = TRUE)

birdtree.pruned<-drop.tip(birdtree,birdtree$tip.label[-na.omit(match(species.to.keep[,1],birdtree$tip.label))])





Method 2

Library(ape)

birddata <- read.csv("H:/ birddata_family_20130405.csv", header = TRUE)

birdtree <- read.nexus("H:/ birddata_family_20130405.nexus")

setwd("H:)



## prune the phylogeny to include only species which are in the data set

temp <- name.check(birdtree, birddata)

birdtree.pruned <- drop.tip(birdtree, tip=temp$Tree.not.data)

        [[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/

Reply via email to