Skip to contents

This function constructs a presence-absence matrix based on the space sites.

Usage

get_presence_matrix(
  species_list,
  space = NULL,
  xy = FALSE,
  empty_sites = FALSE
)

Arguments

species_list

a list of species to include in the calculations.

space

the space to calculate over.

xy

if TRUE, site coordinates are returned as matrix columns. Default is FALSE.

empty_sites

if TRUE, sites with no species will be included in the matrix. Default is FALSE.

Value

a presence matrix with sites as rows and species as columns.

Examples

if (FALSE) { # \dontrun{
  # mock simulation state
  space <- system.file("extdata/SouthAmerica/species_and_spaces/space_t_2.rds", package = "gen3sis2") |> readRDS()
  
  all_species <- system.file("extdata/SouthAmerica/species_and_spaces/species_t_2.rds", package = "gen3sis2") |> readRDS()
  
  data <- list(
    space = space,
    all_species = all_species
  )
  
  get_presence_matrix(data$all_species)[1:5,] # showing just the five first sites
} # }