View source: R/run_simulation.R
| run_simulation | R Documentation | 
Run the individual-based model simulation.
run_simulation(
  path_to_output,
  nb_gens,
  init_comm = comrad::default_init_comm(),
  init_comm_is_from = NA,
  growth_rate = comrad::default_growth_rate(),
  competition_sd = comrad::default_competition_sd(),
  carrying_cap_sd = comrad::default_carrying_cap_sd(),
  carrying_cap_opt = comrad::default_carrying_cap_opt(),
  trait_opt = comrad::default_trait_opt(),
  mutation_sd = comrad::default_mutation_sd(),
  trait_dist_sp = comrad::default_trait_dist_sp(),
  switch_carr_cap_sd_after = NA,
  switch_carr_cap_sd_to = NA,
  sampling_on_event = FALSE,
  sampling_freq = ifelse(sampling_on_event, NA, comrad::set_sampling_freq(nb_gens)),
  sampling_frac = comrad::default_sampling_frac(),
  seed = comrad::default_seed(),
  hpc_job_id = NULL
)
| path_to_output | character, path to save the output file, which must be
a  | 
| nb_gens | integer, the number of generations to run the simulation for. | 
| init_comm | The initial community. Default is  | 
| init_comm_is_from | optional string passed to metadata, where the initial community was taken from (a filename or anything else). | 
| growth_rate | numeric  | 
| competition_sd | numeric  | 
| carrying_cap_sd | numeric  | 
| carrying_cap_opt | numeric, value of the carrying capacity at
 | 
| trait_opt | numeric. The optimal trait value,  | 
| mutation_sd | numeric  | 
| trait_dist_sp | numeric, the minimal trait distance between two clusters of individuals triggering speciation. | 
| switch_carr_cap_sd_after | if not  | 
| switch_carr_cap_sd_to | the value to switch  | 
| sampling_on_event | logical. If  | 
| sampling_freq | numeric  | 
| sampling_frac | numeric (between 0 and 1), fraction of the community (in terms of individuals) written to output at every sampled generation. A truncation is operated. | 
| seed | integer  | 
| hpc_job_id | used to record a job ID in the metadata, only relevant for
simulations run on a high-performance cluster. Otherwise takes value
 | 
Returns a table with a row corresponding to each individual, and five
columns: t is the generation time, z the individual's trait value,
species the name of the species it belongs to, and ancestral_species the
previous species it descends from.
If path_to_output = NULL, the community at the last generation is returned.
If the path to a .csv file is supplied, each sampled generation is appended
to the file. In the .csv, the table is preceded by some lines of metadata,
which are automatically ignored if the file is read with read_comrad_tbl().
Théo Pannetier
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.