Calculates the Index of Relative Rarity for a single or a set of assemblages of species.
1 
assemblages 

W 

abundance 
logical. If 
Wmin 
decimal or 
Wmax 
decimal or 
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 cutoff points) will be dropped.
Occurrencebased Irr, normalised between 0 and 1:
(∑(wi) / S  wmin) / (wmax  wmin)
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.
Abundancebased Irr, normalised between 0 and 1:
(∑(ai*wi) / S  wmin) / (wmax  wmin)
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).
A data.frame containing the Indices of Relative Rarity and the species richness of the assemblage(s).
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.
Boris Leroy leroy.boris@gmail.com
Leroy B., Petillon J., Gallon R., Canard A., & Ysnel F. (2012) Improving occurrencebased rarity metrics in conservation studies by including multiple rarity cutoff points. Insect Conservation and Diversity, 5, 159168.
Leroy B., Canard A., & Ysnel F. 2013. Integrating multiple scales in rarity assessments of invertebrate taxa. Diversity and Distributions, 19, 794803.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40  # 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)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.