Learn R Programming

funrar (version 1.5.0)

uniqueness: Functional Uniqueness for site-species matrix matrix

Description

Computes the functional uniqueness from a site-species matrix with the provided functional distance matrix. Functional Uniqueness represents how "isolated" is a species in the global species pool, it is the functional distance to the nearest neighbor of the species of interest (see Details section for the formula). The sites-species matrix should have sites in rows and species in columns, similar to vegan package defaults.

Usage

uniqueness(pres_matrix, dist_matrix)

Value

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

Arguments

pres_matrix

a site-species matrix (presence-absence or relative abundances), with sites in rows and species in columns

dist_matrix

a species functional distance matrix

Details

Functional Uniqueness \(U_i\) is computed as follow: $$ U_i = \min(d_{ij}) \forall j, j \neq i, $$ with \(U_i\) the functional uniqueness of species \(i\), and \(d_ij\) the functional distance between species \(i\) and species \(j\)

See Also

distinctiveness(), restrictedness(), scarcity()

Examples

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

# Site-species matrix
mat = as.matrix(aravo$spe)
colnames(mat) = as.character(colnames(mat))

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

ui = uniqueness(mat, dist_mat)
head(ui)

# Computing uniqueness for each community
com_ui = apply(mat, 1,
                function(x, dist_m) {
                    smaller_com = x[x > 0 & !is.na(x)]
                    uniqueness(t(as.matrix(smaller_com)), dist_m)
                }, dist_m = dist_mat)

Run the code above in your browser using DataLab