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.
scarcity_com(com_df, sp_col, abund)
a stacked (= tidy) data.frame from a single community with each row representing a species in a community
a character vector, the name of the species column in com_df
a character vector, the name of the column containing relative abundances values
the same data.frame with the additional Si column giving scarcity values for each species
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.
scarcity()
and vignette("rarity_indices", package = "funrar")
for details on the scarcity metric; distinctiveness_com()
to compute
distinctiveness on a single community
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)
#> species site value Si
#> 1 Agro.rupe AR07 0.00000000 1.00000000
#> 76 Alop.alpi AR07 0.00000000 1.00000000
#> 151 Anth.nipp AR07 0.00000000 1.00000000
#> 226 Heli.sede AR07 0.00000000 1.00000000
#> 301 Aven.vers AR07 0.00000000 1.00000000
#> 376 Care.rosa AR07 0.06666667 0.02261358