Hello,

This is Elaine.
I am using the command "write.nexus"in package (ape)
to generate a nexus file after pruning a phylogeny tree.

However, an error appeared, saying
Error in obj[[i]]$tip.label : $ operator is invalid for atomic vectors

I searched the archive but found no similar experience in this command.
Please kindly help explain what it means and how to solve it.

code
library(ape)

# read data and tree
  birddata <- read.csv("H:/birddata_family_20130405.csv", header = TRUE)
  birdtree <- read.nexus("H:/birddata_family_20130405.nexus")
  setwd("H:")

  species.to.keep <-read.csv("H:/birddata_family_20130405.csv", header =
TRUE)
  pruned.tree<-drop.tip(birdtree,birdtree$tip.label[-
  na.omit(match(species.to.keep[,1],birdtree$tip.label))])


  ## prune the data to include only those taxa in the pruned tree
  data.pruned <- birddata[tree.pruned$tip.label, ] (Thanks to Klaus and
others)

  write.nexus(tree.pruned, "H:/pruneddata_20130405.nexus", translate  =
 FALSE)

Elaine

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