Irr {Rarity} | R Documentation |
Index of Relative Rarity
Description
Calculates the Index of Relative Rarity for a single or a set of assemblages of species.
Usage
Irr(assemblages, W, abundance = F, Wmin = min(W), Wmax = max(W))
Arguments
assemblages |
|
W |
|
abundance |
logical. If |
Wmin |
decimal or |
Wmax |
decimal or |
Details
assemblages
can contain a single (vector) or several (matrix or data.frame) assemblages. If assemblages
is a vector, values must be named with species names (e.g. with names(assemblages) <- sp.names
). If assemblages
is a matrix or a data.frame, then rows must be named with species names.
All the species of assemblages
must be contained in W
W
can contain a single vector of rarity weights, or a matrix or a data.frame of rarity weights (e.g. to calculate different Indices of Relative Rarity for different scales). If W
is a vector, values must be named with species names. If W
is a matrix or a data.frame, then species are in rows and each column contains rarity weights. Rows must be named with species names.
If the input of rWeights
is directly entered, then columns Q
(occurrence), R
(rarity status) and cut.off
(rarity cut-off points) will be dropped.
Occurrence-based Irr, normalised between 0 and 1:
\frac{\frac{\sum w_i}{S} - w_{min}}{w_{max} - w_{min}}
where wi is the weight of the ith species in the assemblage, S the assemblage species richness, wmin and wmax the minimum and maximum weights respectively.
Abundance-based Irr, normalised between 0 and 1:
\frac{\frac{\sum a_i w_i}{N} - w_{min}}{w_{max} - w_{min}}
where ai and wi are respectively the abundance and weight of the ith species in the assemblage, N the total number of individuals in the assemblage, and wmin and wmax the minimum and maximum weights respectively.
Species with NA
weights are excluded when indices are computed (they are kept for richness).
Value
A data.frame containing the Indices of Relative Rarity and the species richness of the assemblage(s).
Warning
Column names of W
with names like "Q", "R", "cut.off", "Q1" "Q2" "Q3" and so on, "R1", "R2" "R3" and so on, "cut.off1", "cut.off2", and so on will be ignored.
Author(s)
Boris Leroy leroy.boris@gmail.com
References
Leroy B., Petillon J., Gallon R., Canard A., & Ysnel F. (2012) Improving occurrence-based rarity metrics in conservation studies by including multiple rarity cut-off points. Insect Conservation and Diversity, 5, 159-168.
Leroy B., Canard A., & Ysnel F. 2013. Integrating multiple scales in rarity assessments of invertebrate taxa. Diversity and Distributions, 19, 794-803.
See Also
Examples
# Input rarity weights
data(spid.occ)
# Example of a single scale dataset
regional.occ <- spid.occ$occurMA
names(regional.occ) <- rownames(spid.occ)
head(regional.occ)
# Preparation of rarity weights
rarity.weights <- rWeights(regional.occ)
# Generation of an assemblage matrix
assemblages.matrix <- cbind(assemblage.1 = sample(c(0, 1), 50, replace = TRUE),
assemblage.2 = sample(c(0, 1), 50, replace = TRUE),
assemblage.3 = sample(c(0, 1), 50, replace = TRUE),
assemblage.4 = sample(c(0, 1), 50, replace = TRUE),
assemblage.5 = sample(c(0, 1), 50, replace = TRUE))
# Random attribution of names to the sampled species
rownames(assemblages.matrix) <- sample(names(regional.occ), 50, replace = FALSE)
head(assemblages.matrix)
# Calculation of Irr
Irr(assemblages.matrix, rarity.weights)
# Example of a multi scale dataset
rarity.weights <- rWeights(spid.occ, extended = TRUE)
head(rarity.weights)
# Generation of an assemblage matrix
assemblages.matrix <- cbind(assemblage.1 = sample(c(0, 1), 50, replace = TRUE),
assemblage.2 = sample(c(0, 1), 50, replace = TRUE),
assemblage.3 = sample(c(0, 1), 50, replace = TRUE),
assemblage.4 = sample(c(0, 1), 50, replace = TRUE),
assemblage.5 = sample(c(0, 1), 50, replace = TRUE))
rownames(assemblages.matrix) <- sample(names(regional.occ), 50, replace = FALSE)
head(assemblages.matrix)
# Calculation of Irr
Irr(assemblages.matrix, rarity.weights)