spdf_2data: Creates a data.frame of species' references from...

Description Usage Arguments Value Examples

View source: R/pam_helpers.R

Description

Creates a data.frame of species' references that contains identifiers of position and species name, using a SpatialPolygonsDataFrame as input.

Usage

1
spdf_2data(spdf_object, spdf_grid, parallel = FALSE, n_cores = NULL)

Arguments

spdf_object

SpatialPolygonsDataFrame representing species' geographic distributions. The data.frame associated with the object must contain a column named "Species" to distinguish among features.

spdf_grid

geographic grid for the region of interest (output of function grid_from_region).

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' found in distinct positions (defined with identifiers); includes two columns: "ID" and "Species".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Data
data("species_data", package = "biosurvey")
data("mx", package = "biosurvey")

# GRID
grid_reg <- grid_from_region(region = mx, cell_size = 100)

# Species data from polygons
sp_data <- spdf_2data(spdf_object = species_data, spdf_grid = grid_reg)
summary(sp_data)

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