data(sampletrees)
sampletrees <- sample(sampletrees,5)
data(occurrences)
occu <- getBioclimVars(occurrences, which.biovars=c(1,2))
sp_data_min<-sapply(4:5,function(x) tapply(occu[,x],occu$Species,min))
sp_data_max<-sapply(4:5,function(x) tapply(occu[,x],occu$Species,max))
ex_min <- geiger::treedata(sampletrees[[1]], sp_data_min, sort=TRUE)
ex_max <- geiger::treedata(sampletrees[[1]], sp_data_max, sort=TRUE)
colnames(ex_min$data)<- colnames(ex_max$data)<-c("bio1","bio2") #labels biovars
nodeest<- nodeEstimateEnvelopes(treedata_min=ex_min,treedata_max=ex_max,
model="BM",which.biovars=c(1,2),
bounds=list(sigsq = c(min = 0, max = 1000000)))
Run the code above in your browser using DataLab