getLineageClimate: getLineageClimate

View source: R/getLineageClimate.R

getLineageClimateR Documentation

getLineageClimate

Description

This function calculates the suitable climate for each specific lineage, starting at the tips and going back through time to the root.

Usage

getLineageClimate(envelope, tree, which.biovars, 
use.paleoclimate=TRUE, paleoclimateUser=NULL)

Arguments

envelope

the min and max climate envelope of each lineage for each time slice, as outputted by getEnvelopes()

tree

the phylogeny of all species. An object of class phylo

which.biovars

a vector of the numbers of the bioclimate variables to be included. The bioclimate variables number correspond to the table at (https://www.worldclim.org/data/bioclim.html).

use.paleoclimate

if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided

paleoclimateUser

list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see getBioclimvars()).

Details

Calculates rate of geographic change of all lineages. Outputs both the geographic center change, and the geographic size change.

Value

matchedClim list of occurrences points for each lineage, for each time slice of paleoclimate data

lineage list of lineage specific nodes, as output from phangorn::Ancestors

Author(s)

A. Michelle Lawing, Alexandra F. C. Howard, Maria A. Hurtado-Materon

See Also

getEnvelopes() getGeoRate()

Examples

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)

michellelawing/ppgm documentation built on April 24, 2024, 10:17 p.m.