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?
When I tried to follow the book for ancestral reconstruction, the following error occurred: here are my code: