stack_2data: Creates a data.frame of species' references from SpatRaster

View source: R/pam_helpers.R

stack_2dataR Documentation

Creates a data.frame of species' references from SpatRaster

Description

Creates a data.frame of species' references that contains longitude, latitude, and species name, using a SpatRaster representing multiple species as input.

Usage

stack_2data(species_layers)

Arguments

species_layers

SpatRaster object. Each layer must be named as the species that it represents, and values in each layer must be 1 (presence) and 0 (absence).

Value

A data.frame of species geographic records derived from values of presence in each layer from the SpatRaster

Examples

# Data
rsp <- terra::rast(system.file("extdata/sp_layers.tif",
                                package = "biosurvey"))
names(rsp) <- paste0("Species_", 1:5)

# Species data from SpatRaster
sp_data <- stack_2data(species_layers = rsp)
summary(sp_data)

claununez/biosurvey documentation built on April 25, 2024, 12:24 a.m.