scarcity_com: Scarcity for a single community

View source: R/scarcity.R

scarcity_comR Documentation

Scarcity for a single community

Description

Given a stacked data.frame compute species scarcity. Scarcity measures how abundant is a species locally. Scarcity is close to 1 when a species is rare in a community and close to 0 when it is abundant. See scarcity() function or the functional rarity indices vignette included in the package (type vignette("rarity_indices", package = "funrar")) for details about the index.

Usage

scarcity_com(com_df, sp_col, abund)

Arguments

com_df

a stacked (= tidy) data.frame from a single community with each row representing a species in a community

sp_col

a character vector, the name of the species column in com_df

abund

a character vector, the name of the column containing relative abundances values

Value

the same data.frame with the additional Si column giving scarcity values for each species

Caution

This function is meant for internal uses mostly, thus it does not include any tests on inputs and may fail unexpectedly. Please use scarcity_stack() to avoid input errors.

See Also

scarcity() and vignette("rarity_indices", package = "funrar") for details on the scarcity metric; distinctiveness_com() to compute distinctiveness on a single community

Examples

data("aravo", package = "ade4")

# Site-species matrix converted into data.frame
mat = as.matrix(aravo$spe)
mat = make_relative(mat)
dat = matrix_to_stack(mat, "value", "site", "species")
dat$site = as.character(dat$site)
dat$species = as.character(dat$species)

si_df = scarcity_com(subset(dat, site == "AR07"), "species", "value")
head(si_df)


Rekyt/outlieR documentation built on Sept. 26, 2022, 2:22 a.m.