Flags and filters in-situ events relative to island formation age
age_correct_events.RdCompares the age of each classified node to the formation age of the island it is assigned to. Nodes that predate island formation are biologically impossible and represent either errors in the ancestral state reconstruction or lineages whose common ancestor actually predates the island. These nodes are flagged and optionally removed. This function also computes island-age-corrected rates by replacing the full path length denominator with the time elapsed since island formation, which is the relevant timescale for assessing how rapidly an island has diversified.
Arguments
- events
The data frame returned by
map_insitu_events.- phy
The matched phylogenetic tree.
- island_ages
A named numeric vector of island formation ages, in the same units as the branch lengths of
phy. Names must match the island names inevents.- remove_predating
Logical. If
TRUE, nodes that predate island formation are removed from the returned events table. IfFALSE(default), they are retained but flagged in thepredates_islandcolumn.
Value
The events data frame with three additional columns:
node_ageAge of the node in the same units as branch lengths (time before present).
island_ageFormation age of the island assigned to that node.
predates_islandLogical.
TRUEif the node age exceeds the island formation age, meaning the event predates the island's existence.