Compute scarcity values for several communities. Scarcity computation requires relative abundances. 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. You can either use _stack() or _tidy() functions as they are aliases of one another.

scarcity_stack(com_df, sp_col, com, abund)

scarcity_tidy(com_df, sp_col, com, 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

com

a character vector indicating the column name of communities ID in com_df

abund

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

Value

The same table as com_df with an added \(S_i\) column for Scarcity values.

See also

scarcity() and vignette("rarity_indices", package = "funrar") for details on the scarcity metric; distinctiveness_stack(), restrictedness_stack(), uniqueness_stack()

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_stack(dat, "species", "site", "value")
head(si_df)
#>     species site   value         Si
#> 1 Agro.rupe AR01 0.03125 0.16928194
#> 2 Alop.alpi AR01 0.00000 1.00000000
#> 3 Anth.nipp AR01 0.00000 1.00000000
#> 4 Heli.sede AR01 0.06250 0.02865638
#> 5 Aven.vers AR01 0.00000 1.00000000
#> 6 Care.rosa AR01 0.00000 1.00000000