Skip to contents

Run simulation

Main gen3sis2 functions to run and summarize simulations

gen3sis2-package gen3sis2
gen3sis2: General Engine for Eco-Evolutionary Simulations
run_simulation()
Run a simulation in gen3sis and return a summary object possibly saving outputs and plots to the output folder

User defined simulation functions

Functions defined by the user and called by the simulation

apply_ecology()
Allows the user to define the ecological consequences for species within each site, defining thus species survival and abundance
apply_modifiers()
Allows the user to populate the world at the beginning of a simulation
apply_trait_evolution()
Allows defining the function that changes the values of traits of a given species at each time-step and in each site. If no operations are provided, traits are not changing
create_ancestor_species()
Allows the user to populate the world at the beginning of a simulation
get_dispersal_values()
Allows the user to generate dispersal value(s) for a given species. The simulation request the user to return a vector of dispersal values with length specified by the num_draws parameter
get_divergence_factor()
Allows the user to define the rate at which geographic clusters accumulate differentiation with each other.
get_modifiers()
Computed the object used to modify the environmental variables trough the simulation

Functions that are used in the simulation but are not user defined

create_species()
Creates a new species
evolution_mode_none()
No evolution considered

Configuration file

Functions to create and handle configs

create_empty_config()
Creates an empty config object
create_input_config()
Creates either an empty configuration or a pre-filled configuration object from a config file
prepare_directories()
Checks if the necessary directories exist, and otherwise creates them
verify_config()
Verifies if all required config fields are provided
write_config_skeleton()
Writes out a config skeleton

Spaces input

Functions to create and handle spaces input

check_names()
Check names of spaces
check_spaces()
Check gen3sis_spaces
create_spaces()
create empty gen3sis_spaces
create_spaces_raster()
Create an spaces input from a named list of rasters or raster files and user defined cost function
is_geodynamic()
Determine if environmental data is geodynamic

Plotting functions

Functions used to plot gen3sis 2 spaces and species

color_richness()
Define richness color scale which is colour-vision deficient and colour-blind people safe based on scientific colour maps by Fabio Crameri
color_richness_CVDCBP()
Define gen3sis richness color scale for non colour-vision deficient
plot_ranges()
Plot species ranges of the given list of species on a space
plot_richness()
Plot the richness of the given list of species on a space
plot_space()
Plot the environment variable of a given space
plot_space_overview()
Plot the outline of a given space over time
plot_species_abundance()
Plot a species' abundance on a given space
plot_species_presence()
Plot a species' presence on a given space
plot_summary()
Plot simulation default summary object
raster_plot_aesthetics()
Provides the default gen3sis2 plot aesthetics for raster spaces
set_color()
Set the color scale for plots, adding zero_col if zero values are present
sf_plot_aesthetics()
Provides the default gen3sis2 plot aesthetics for H3 and points spaces

Support functions

Functions that can be used to save, get and handle sumation information

distance_subset()
Subset distance matrix
diversification_summary()
Diverisification summary
get_abundance_matrix()
Get abundance matrix
get_divergence_matrix()
Returns the full divergence matrix for a given species (site x site).
get_extant_species()
Gets extant species
get_geo_richness()
calculate the richness of a list of species over a given space
get_mean_richness()
Get global mean richness
get_presence_matrix()
Get presence-absence matrix
get_site_abundance()
Gets site abundance
get_space_subset()
Gets space subset
get_species_prevalence()
Get species prevalence
get_species_range()
Gets species range
get_species_subset()
Gets species subset
get_trait_abundance()
Get abundance and traits matrix
get_trait_diversity()
Get trait diversity
get_trait_evenness()
Get trait evenness
get_traits_matrix()
Get traits matrix
get_weighted_endemism()
Gets weighted endemism
save_abundance()
This function can be called within the observer function to save the species abundances.
save_divergence()
This function can be called within the observer function to save the compressed species divergence.
save_occupancy()
This function can be called within the observer function to save the current occupancy pattern
save_phylogeny()
This function can be called within the observer function to save the current phylogeny.
save_richness()
This function can be called within the observer function to save the current richness pattern
save_space()
This function can be called within the observer function to save the current space, can be called independently by the user and is called by other observer functions relying on the space to be present (e.g. save_species)
save_species()
This function can be called within the observer function to save the full species list.
save_traits()
This function can be called within the observer function to save the species traits.
time_unit_check()
Check if the used time unit is accepted