distinctiveness_stack {funrar}R Documentation

Functional Distinctiveness on a stacked data.frame

Description

Compute Functional Distinctiveness for several communities, from a stacked (or tidy) data.frame of communities, with one column for species identity, one for community identity and an optional one for relative abundances. Also needs a species functional distances matrix. Functional distinctiveness relates to the functional "originality" of a species in a community. The closer to 1 the more the species is functionally distinct from the rest of the community. See distinctiveness() function or the functional rarity indices vignette included in the package (type vignette("rarity_indices", package = "funrar")), for more details on the metric. IMPORTANT NOTE: in order to get functional rarity indices between 0 and 1, the distance metric has to be scaled between 0 and 1. You can either use ⁠_stack()⁠ or ⁠_tidy()⁠ functions as they are aliases of one another.

Usage

distinctiveness_stack(
  com_df,
  sp_col,
  com,
  abund = NULL,
  dist_matrix,
  relative = FALSE
)

distinctiveness_tidy(
  com_df,
  sp_col,
  com,
  abund = NULL,
  dist_matrix,
  relative = FALSE
)

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, the column name for communities names

abund

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

dist_matrix

a functional distance matrix as given by compute_dist_matrix(), with species name as row and column names

relative

a logical indicating if distinctiveness should be scaled relatively to the community (scaled by max functional distance among the species of the targeted community)

Value

the same data.frame with the additional Di column giving functional distinctiveness values for each species

See Also

scarcity_stack(), uniqueness_stack(), restrictedness_stack(); distinctiveness() Details section for detail on the index

Examples

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

# Example of trait table
tra = aravo$traits[, c("Height", "SLA", "N_mass")]
# Distance matrix
dist_mat = compute_dist_matrix(tra)

# 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)

di_df = distinctiveness_stack(dat, "species", "site", "value", dist_mat)
head(di_df)


[Package funrar version 1.5.0 Index]