Skip to contents

Reads a text configuration file (KEY = value), merges values with package defaults, validates options, resolves gradient specifications into a tidy table, materialises quadrat sizes, and sets the random seed. This is the only supported public entry point for reading configs; low-level parsing is handled internally.

Usage

load_config(init_file)

Arguments

init_file

Character scalar; path to the configuration file.

Value

A named list P with fully-resolved parameters used by the simulator (including a tidy P$GRADIENT tibble and P$QUADRAT_SIZE).

Details

Supported value forms:

  • Scalars: 300, TRUE, 0.15, "#22223b".

  • Comma vectors: A,B,C or 0.1, 0.2, 0.3.

  • R-style character vectors for inline edgelists: e.g. INTERACTIONS_EDGELIST = c("A,B-D,0.8", "C,A,1.2", "E,*,0.95").

  • Named entries: A:0.55, temperature:0.12.

You may specify INTERACTIONS_FILE = "path/to/interactions.txt" to point to a separate interactions config, or embed rules directly with INTERACTIONS_EDGELIST = c("A,B-D,0.8", "C,A,1.2"). If neither is provided, interactions default to neutral (all 1.0) with INTERACTION_RADIUS = 0.

Gradient keys can be arbitrary driver names (legacy defaults: temperature, elevation, rainfall). Use GRADIENT_SPECIES, GRADIENT_ASSIGNMENTS, plus either GRADIENT_OPTIMA and GRADIENT_TOLERANCE as scalar, per-species named, or per-gradient named values.

Model-family presets:

  • manual: no high-level preset.

  • niche_filtering: baseline Poisson placement plus gradient filtering.

  • neutral_csr: neutral SAD baseline with CSR placement.

  • neutral_hubbell_like: sequential neutral recruitment with immigration/speciation and dispersal.

  • hybrid: neutral recruitment with environmental sorting during recruitment.

Constrained landscape options:

  • DOMAIN_TYPE = "network" or "coastline" enables a linearized coordinate for recruitment and distance-decay summaries.

  • DISTANCE_METRIC = "along_path" uses along-coordinate distance.

  • ENV_COVARIATES_FILE can supply external section/node covariates (CSV with x, y, and environmental columns).

Examples

if (FALSE) { # \dontrun{
P <- load_config("inst/examples/spesim_init_complete.txt")
} # }