model_abundance: Calculate predicted abundance

View source: R/model_abundance.R

model_abundanceR Documentation

Calculate predicted abundance

Description

Calculates the predicted abundance by multiplying the density prediction values by prediction polygon areas

Usage

model_abundance(x, dens.idx, sum.abund = TRUE)

Arguments

x

object of class sf; SDM with density predictions. Must have a valid crs code

dens.idx

name or index of column(s) in x with density predictions. Can be a character vector (column names) or numeric vector (column indices)

sum.abund

logical; whether or not to sum all of the predicted abundances

Details

Multiplies the values in the specified column(s) (i.e. the density predictions) by the area in square kilometers of their corresponding prediction polygon. The area of each prediction polygon is calculated using st_area from geos_measures. x must have a valid crs code to calculate area for these abundance calculations.

Value

If sum.abund == TRUE, then a vector of the same length as dens.idx representing the predicted abundance for the density values in each column.

If sum.abund == FALSE and the length of dens.idx is 1, then a numeric vector with the predicted abundance of each prediction polygon of x.

If sum.abund == FALSE and the length of dens.idx is greater than 1, then a data frame with length(dens.idx) columns of the predicted abundance of prediction polygons

Examples

model_abundance(preds.1, "Density")
model_abundance(preds.1, c(1, 1))
model_abundance(preds.1, c(1, 1), FALSE)


eSDM documentation built on Oct. 25, 2023, 1:08 a.m.