Learn R Programming

funrar (version 1.5.0)

uniqueness_stack: Functional Uniqueness on stacked data.frame

Description

Computes functional uniqueness values over a given regional pool. Functional uniqueness gives the functional distance to the nearest-neighbor of a given species in the provided distance matrix. See uniqueness() function for details on computation. You can either use _stack() or _tidy() functions as they are aliases of one another.

Usage

uniqueness_stack(com_df, sp_col, dist_matrix)

uniqueness_tidy(com_df, sp_col, dist_matrix)

Value

A data.frame with uniqueness value per species, with one column with provided species column name and the Ui column with the uniqueness values.

Arguments

com_df

a data frame of the species in the regional pool.

sp_col

a character vector indicating the name of the species column in the com_df data frame

dist_matrix

a functional distance matrix

See Also

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

Examples

Run this code
data("aravo", package = "ade4")

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

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

ui_df = uniqueness_stack(dat, "species", dist_mat)
head(ui_df)

Run the code above in your browser using DataLab