apply_speciation: Resolve speciation in a comrad community

View source: R/apply_speciation.R

apply_speciationR Documentation

Resolve speciation in a comrad community

Description

For each species, check if there is any gap ⁠>= trait_dist_sp⁠ in trait values, and split the relevant species in two when one is found. The less numerous half becomes the new species.

Usage

apply_speciation(comm, trait_dist_sp = default_trait_dist_sp())

Arguments

comm

a tibble with one row per individual in the community and three columns:

  • z contains (numeric) traits values

  • species contains species names (characters)

  • ancestral_species contains acnestral species names (characters)

trait_dist_sp

numeric, the minimal trait distance between two clusters of individuals triggering speciation.

Note

apply_speciation() can currently only split one species into two. If multiple gaps emerge in a species at a single time step, only the first one will be treated. As long as branching does not happen at every generation, this is unlikely to be an issue, because an unresolved gap will be caught on the next time step. In phylogenetic terms, this results in polytomies being resolved as soft polytomies. Besides, simultaneous branching events in different species are handled perfectly fine.

Author(s)

Théo Pannetier


TheoPannetier/comrad documentation built on April 8, 2023, 8:06 a.m.