数据中的行数与phyloglm中树中的提示数不匹配

时间:2017-07-20 13:37:29

标签: r regression phylogeny

我似乎无法看到我在哪里弄错了。我正在使用包phylolm对系统发育数据做一些回归

我的模型未运行并返回错误:phyloglm(testVar ~ ...the number of rows in the data does not match the number of tips in the tree.

中的错误

我已经做了一切检查,但我的树中的物种和我的数据中的物种是匹配的。 我的代码是

diet<-read.csv("dat.csv",h=T,dec = ".")
phy=read.nexus("ConsTree.tre")# the phylogenetic data
keep.spp<-levels(diet$ScientificName)
phylo<-drop.tip(phy,phy$tip.label[-match(keep.spp, phy$tip.label)])

setdiff(phylo$tip.label,diet$ScientificName)# this confirms that all is OK
t1<-phyloglm(testVar~Var1+Var2+Var3, diet, phylo)

t1<-phyloglm(testVar~Var1+Var2+Var3, diet, phylo, 
             method = c("logistic_MPLE","logistic_IG10","poisson_GEE"), 
             btol = 10, log.alpha.bound = 4,
             start.beta=NULL, start.alpha=NULL,
             boot = 0, full.matrix = TRUE)

   #
    Error in phyloglm(testVar~Var1+Var2+Var3,..the number of rows in the data does not match the number of tips in the tree.

有人能指出我弄错了吗?

1 个答案:

答案 0 :(得分:1)

对这件小事视而不见的歉意...... 我应该在我的数据中重命名我的row.names

row.names(diet)<-diet$ScientificName