Skip to contents

This function realizes the state target for a given simulation object into either binary (presence/absence) or abundance using a predefined or a custom function. The updated simulation object with the new state target realization and metadata is returned.

Usage

sim_state_target_realise(simulation_object, fun, filename = NULL, ...)

Arguments

simulation_object

A SimulationObject containing the state environment.

fun

A custom function that takes a SimulationObject with an environment slot and outputs a target suitability SpatRaster indicating either presence/absence or abundance.

filename

A character string specifying the filename to save the resultant SpatRaster. If `NULL`, the SpatRaster is not saved to a file. Default is `NULL`.

...

Additional arguments to be passed to the function specified in `fun`.

Value

The updated simulation object with the new state target realization.

Details

- If `fun` is a custom function, it will be applied to the simulation object. - If `filename` is provided, the resultant SpatRaster is saved, and the filename is returned.

Examples

if (FALSE) { # \dontrun{
sim_obj <- sim_state_target_realise(sim_obj, fun = state_target_realise_binomial)
sim_obj <- sim_state_target_realise(sim_obj, fun = state_target_realise_threshold, threshold = 0.5)
sim_obj <- sim_state_target_realise(sim_obj, fun = my_custom_function)
sim_obj <- sim_state_target_realise(sim_obj, fun = my_custom_function, filename = "output.tif")
} # }