data(sampletrees)
data(occurrences)
data(paleoclimate)
occu <- getBioclimVars(occurrences, which.biovars=1)
tree <- sampletrees[[25]]
#species minimum for biovariable 1
sp_data_min<- tapply(occu[,4],occu$Species,min)
#species maximum for biovariable 1
sp_data_max<- tapply(occu[,4],occu$Species,max)
#convert to treedata object
treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F)
treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F)
#estimate node values using Brownian Motion
full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max)
node_est <- full_est$est #extract only node estimates
#calculate climate envelopes
example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est)
#calculate lineage specific climate
example_getLinClim <- getLineageClimate(example_getEnvelopes, tree, which.biovars=1)
Run the code above in your browser using DataLab