Skip to contents

Calculate species suitability from a given raster, species names and landuse 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.

Usage

species_suitability_landuse(
  Rasterspecieslanduse,
  species_names,
  landuses,
  parameter = "SpeciesSuitabilityLanduse",
  name = "Problem",
  verbose = FALSE
)

Arguments

Rasterspecieslanduse

a list of species suitability for each landuse

species_names

character vector of species names

landuses

character vector with all landuses

parameter

The name of the parameter to use

name

The name of the output file

verbose

Logical whether messages will be written while the function is generating calculations, defaults to FALSE

Value

.dat file. This function is used for the side-effect of writing values to a file.

Examples

library(terra)
data("Species_Landuse")
Species_Landuse <- Species_Landuse |> purrr::map(terra::unwrap)
species_suitability_landuse(Rasterspecieslanduse = Species_Landuse,
species_names = c("Spp1", "Spp2", "Spp3", "Spp4"),
landuses = c("Agriculture", "Forest", "Urban"), name = "Test")
file.remove("Test.dat")
#> [1] TRUE