This function takes a Raster object, uses its values as a parameter and writes them to a .dat file. The file
will be written to the location specified by the name
argument. If the file
already exists, it will be overwritten. The file format is plain text, with each
line terminated by a newline character.
Arguments
- Rasterparam
A Raster object with the values for the parameter
- parameter
The name of the parameter to use
- default
The value of the default value for the parameter if there is one, otherwise keep it as NULL
- name
The name of the output file
- verbose
Logical whether messages will be written while the function is generating calculations, defaults to FALSE
Examples
library(terra)
A <- TroublemakeR::Current |> terra::unwrap()
A <- A[[1]]
write_cell_param(Rasterparam = A, parameter = "Suitability", name = "Problem")
write_cell_param(Rasterparam = A, parameter = "Carbon", default = 1,
name = "Problem")
write_cell_param(Rasterparam = A, parameter = "Cost", default = 0,
name = "Problem")
file.remove("Problem.dat")
#> [1] TRUE