Hello Klaus,
Thank you for the code.
However, I found data.prunden output as csv did not have tip.label
(https://www.box.com/files/0/f/766727938/1/f_7323302849).
Actually, it should look like birddata.
https://www.box.com/files/0/f/766727938/1/f_7323300929
Please kindly help indicate if anything wrong with the code below.
Thanks again.
Elaine
code
library(ape)
birddata <- read.csv("H:/birddata_family_20130405.csv", header = TRUE)
birdtree <- read.nexus("H:/birddata_family_20130405.nexus")
setwd("H:")
temp <- name.check(birdtree, birddata)
birdtree.pruned <- drop.tip(birdtree, tip=temp$Tree.not.data)
#prune the data to include only those taxa in the pruned tree
birddata.pruned <- birddata[birdtree.pruned$tip.label, ]
write.csv(birddata.pruned,"H:/birddatapruned_20130405.csv")
On Fri, Apr 5, 2013 at 5:37 PM, Klaus Schliep <[email protected]>wrote:
> Hi Elaine,
>
> you should try to subset your data set data set and not the function data!
> Try:
> data.pruned <- birddata[tree.pruned$tip.label, ]
>
> Regards,
> Klaus
>
>
>
>
> On 4/5/13, Elaine Kuo <[email protected]> wrote:
> > Hello,
> >
> > I am using the following code to prune a phylogeny tree of bird family.
> > However, an error appeared when running the last line of the code,
> saying:
> >
> > Error in data[tree.pruned$tip.label, ] :
> > object of type 'closure' is not subsettable
> >
> >
> > I do not understand the error message.
> > Please kindly help explain and advise if any further information
> > is in need to solve the issue.
> >
> > Thank you.
> > Elaine
> >
> >
> > Code
> > library(geiger)
> >
> > # read data and tree
> > birddata <-read.csv("H:/birddata_family_20130405.csv", header = TRUE)
> > birdtree <- read.nexus("H:/birddata_family_20130405.nexus")
> > setwd("H:")
> >
> > #temp <- name.check(birdtree, birddata)
> > tree.pruned <- drop.tip(birdtree, tip=temp$Tree.not.data)
> >
> > ## prune the data to include only those taxa in the pruned tree
> > data.pruned <- data[tree.pruned$tip.label, ]
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-phylo mailing list - [email protected]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> > Searchable archive at
> > http://www.mail-archive.com/[email protected]/
> >
>
>
> --
> Klaus Schliep
> Phylogenomics Lab at the University of Vigo, Spain
>
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/