calcSpeciesAverageInPus {raptr} | R Documentation |
Calculate average value for species data in planning units
Description
This function calculates the average of species values in each planning unit. By default all polygons will be treated as having separate ids.
Usage
calcSpeciesAverageInPus(x, ...)
## S3 method for class 'SpatialPolygons'
calcSpeciesAverageInPus(x, y, ids = seq_len(terra::nlyr(y)), ...)
## S3 method for class 'SpatialPolygonsDataFrame'
calcSpeciesAverageInPus(x, y, ids = seq_len(terra::nlyr(y)), field = NULL, ...)
## S3 method for class 'sf'
calcSpeciesAverageInPus(x, y, ids = seq_len(terra::nlyr(y)), field = NULL, ...)
Arguments
x |
|
... |
not used. |
y |
|
ids |
|
field |
|
Value
A base::data.frame()
object.
Note
Although earlier versions of the package had an additional ncores
parameter, this parameter has been deprecated.
Examples
## Not run:
# simulate data
sim_pus <- sim.pus(225L)
sim_spp <- terra::rast(
lapply(c("uniform", "normal", "bimodal"),
sim.species, n = 1, res = 1, x = sim_pus)
)
# calculate average for 1 species
puvspr1.dat <- calcSpeciesAverageInPus(sim_pus, sim_spp[[1]])
# calculate average for multiple species
puvspr2.dat <- calcSpeciesAverageInPus(sim_pus, sim_spp)
## End(Not run)
[Package raptr version 1.0.1 Index]