rlist_2data: Creates a data.frame of species' references from a list of...

Description Usage Arguments Value Examples

View source: R/pam_helpers.R

Description

Creates a data.frame of species' references that contains longitude, latitude, and species name, using a list of raster layers as input. Useful when raster layers have distinct extent or resolution.

Usage

1
rlist_2data(raster_list, parallel = FALSE, n_cores = NULL)

Arguments

raster_list

list of RasterLayer objects. Each raster layer must be named as the species that it represents, and values in each layer must be 1 (presence) and 0 (absence).

parallel

(logical) whether to perform analyses in parallel. Default = FALSE.

n_cores

(numeric) number of cores to be used when parallel = TRUE. The default, NULL, uses available cores - 1.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Data
rsp <- raster::stack(system.file("extdata/sp_layers.tif",
                     package = "biosurvey"))
names(rsp) <- paste0("Species_", 1:5)

rlist <- lapply(1:5, function(x) {rsp[[x]]})

# Species data from RasterStack
sp_data <- rlist_2data(raster_list = rlist)
summary(sp_data)

biosurvey documentation built on Sept. 16, 2021, 1:07 a.m.