Hello, I am currently trying to run make.simmap in Phytools ver 0.6-60 and Geiger ver 2.0.6, I am running the function on a subsample of 500 trees from the posterior distribution. I have included the full code, but there error I get is found in the last line of code
simtrees<-list(500) YY<-list(500) for (i in 1:500){ simtrees[[i]]<-make.simmap(CrenuchidTreesLadderized[[i]], habitattrait, model="ER", nsim=1000) YY[[i]]<- describe.simmap(simtree[[i]], plot=F) } ERROR = Error in UseMethod("isSymmetric") : no applicable method for 'isSymmetric' applied to an object of class "c('double', 'numeric')" Any help would be greatly appreciated, full code below: require(phytools) require(geiger) habitat<-read.csv("C:/Users/XXX/Dropbox/Crenuchid R Files/Crenuchid R Files/Crenuchid_2state_BvsP.csv", row.names=1) habitat[habitat==0] <- "Pelagic" habitat[habitat==1] <- "Benthic" habitat_color <- habitat habitat_color[habitat=="Benthic"] <- "#6EA0FF" ### blue habitat_color[habitat=="Pelagic"] <- "#FFB322" ### Orange ############################# simmap multiple trees ################################################. alltrees<-read.nexus("posteriorsamples.tre.trprobs") #reading trees from posteior distribution wib <- name.check(phy=alltrees[[1]], data=habitat) wib ## will show what is in tree not data, data not tree # ??name.check # Now to drop tips length(alltrees) prunedpostsamp<-list(500) for (i in 1:500){ prunedpostsamp[[i]]<-drop.tip(alltrees[[i]], wib$tree_not_data) } wib <- name.check(phy=prunedpostsamp[[1]], data=habitat) prunedpostsamp[[1]]$tip.label #Let's ladderize all trees in the distribution with lapply() and plot the first tree again CrenuchidTreesLadderized <- lapply(prunedpostsamp, ladderize) plot(CrenuchidTreesLadderized[[1]], cex=0.4) #Plot the first ladderized tree #However, does the order of tips in the plot match the order of tiplabels in the tree object? #### NO help? is this the issue ??? #Please compare###################################################################################### CrenuchidTreesLadderized[[1]]$tip.label habitattrait<-habitat[CrenuchidTreesLadderized[[1]]$tip.label,] names(habitattrait)<- CrenuchidTreesLadderized[[1]]$tip.label length(habitattrait) ## 54 class(habitattrait) ## character #Compare tree with data compare <- treedata(CrenuchidTreesLadderized[[1]], habitattrait, sort=TRUE) #R will inform you of any inconsistencies and how they were solved! ?treedata ####### SIMMAP for multiple trees this can take a while while while ######## simtrees<-list(500) YY<-list(500) for (i in 1:500){ simtrees[[i]]<-make.simmap(CrenuchidTreesLadderized[[i]], habitattrait, model="ER", nsim=1000) YY[[i]]<- describe.simmap(simtree[[i]], plot=F) } [[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/