liamrevell / phytools

GNU General Public License v3.0
198 stars 56 forks source link

subscript out of bounds #148

Open ZestingJin opened 5 months ago

ZestingJin commented 5 months ago

When I tried to follow the book for ancestral reconstruction, the following error occurred: here are my code:

library(phytools) ger.data <- read.csv("habitats_try.csv",row.names=1,stringsAsFactors=TRUE) ger.tree <- read.tree("timetree1.tre") habitats <- setNames(ger.data[,1],rownames(ger.data)) fitER<-fitMk(ger.tree,habitats,model="ER") Error in x[tree$tip.label, ] : subscript out of bounds How should I resolve this error?