Determine the Target Suitability from the State Environment
sim_state_target_suitability.Rd
This function calculates the state target suitability for a given simulation object using either a predefined or a custom function. The updated simulation object with the new state target suitability and metadata is returned.
Arguments
- simulation_object
A SimulationObject
- fun
Either 'uniform' to use the included uniform suitability function or a custom function that takes a SimulationObject with an environment slot and outputs a target suitability SpatRaster with as many bands as there are targets
- filename
A character string specifying the filename to save the resultant SpatRaster. If `NULL`, the SpatRaster is not saved to a file.
- ...
Additional arguments to be passed to the function specified in `fun`.
Details
- If `fun` is provided as 'uniform', the function uses the included uniform suitability function. This is unlikely to be a useful function but provided as a baseline. - If `fun` is a character string corresponding to a function name, the function checks its existence and retrieves it. - 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_suitability(sim_obj, fun = state_target_suitability_uniform, value = 0.5)
sim_obj <- sim_state_target_suitability(sim_obj, fun = my_custom_function)
sim_obj <- sim_state_target_suitability(sim_obj, fun = my_custom_function, filename = "output.tif")
} # }