| Title: | Marine Benthic Ecosystem Analysis |
|---|---|
| Description: | Preprocessing tools and biodiversity measures (species abundance, species richness, population heterogeneity and sensitivity) for analysing marine benthic data. See Van Loon et al. (2015) <doi:10.1016/j.seares.2015.05.002> for an application of these tools. |
| Authors: | Dennis Walvoort [aut, cre, cph] |
| Maintainer: | Dennis Walvoort <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.0-0 |
| Built: | 2026-05-20 10:39:24 UTC |
| Source: | https://github.com/cran/benthos |
benthos provides functions for facilitating the analysis of marine benthos data. Examples are indicators like species abundance, species richness, Margalef's index of diversity, Shannon's Entropy, AZTI's Marine Biotic Index, and the Infaunal Trophic Index (ITI). In addition functions for data pooling, genus-to-species conversion and validation and conversion of species names to those recommended by the World Register of Marine Species are provided.
All functions are designed to work seamlessly with the dplyr-package which implements a grammar for structured data manipulation.
The benthos-package contains functions for estimating various species abundance, species richness, species heterogeneity and species sensitivity measures:
total abundance (total_abundance)
abundance (abundance)
species richness (species_richness)
Margalef's index of diversity (margalef)
Rygg's index of diversity (rygg)
Hurlbert's Expected Number of Species (hurlbert)
Simpson's measure of concentration (simpson)
Hurlbert's probability of interspecific encounter (PIE)
(hpie)
Shannon's index or entropy (shannon)
Hill's diversity number (hill)
AZTI Marine Biotic Index (AMBI) (ambi)
Infaunal Trophic Index (ITI) (iti)
Bray-Curtis dissimilarity (bray_curtis)
In addition, functions are available for data preparation, e.g.:
data pooling (pool)
genus to species conversion (genus_to_species)
For an overview of all the functions in the package click on the index link at the bottom of this page.
Dennis Walvoort [email protected]
The BEQI2-package on CRAN, and the package vignettes.
The number of individuals in each taxon.
abundance(taxon = NULL, count)abundance(taxon = NULL, count)
taxon |
character vector containing taxa |
count |
numeric vector containing counts |
numeric vector with abundance per taxon.
due to pooling, the abundance is not necessarily an integer
abundance( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )abundance( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )
AZTI Marine Biotic Index (AMBI) according to Borja et al. (2000).
ambi(taxon, count, group = NULL) has_ambi(taxon, group = NULL)ambi(taxon, count, group = NULL) has_ambi(taxon, group = NULL)
taxon |
species names |
count |
counts of individuals ( |
group |
sensitivity groups I, II, III, IV, or V |
The index is given by:
where is the proportion of species in sensitivity group .
numeric vector of length 1 containing the AMBI
has_ambi(): tests if an AMBI sensitivity group is available for
taxon (returns TRUE (available) or
FALSE (unavailable))
Borja, A., J. Franco and V. Perez, 2000. A Marine Biotic Index to Establish the Ecological Quality of Soft-Bottom Benthos Within European Estuarine and Coastal Environments. Marine Pollution Bulletin 40:1100-1114
ambi( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) ) data(oosterschelde) has_ambi(oosterschelde$TAXON)ambi( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) ) data(oosterschelde) has_ambi(oosterschelde$TAXON)
Taxon names are standardized according to the World Register of Marine Species (WoRMS) database. The conversion is case-insensitive. For this conversion, the TWN-list (Taxa Water management the Netherlands) is used, extended with species of the Southern North Sea. See references below for download locations.
as_accepted(taxon, taxa = NULL)as_accepted(taxon, taxa = NULL)
taxon |
|
taxa |
an optional table usually created with |
character vector with WoRMS/TWN compliant species names
https://www.marinespecies.org/
Bray-Curtis Dissimilarity
bray_curtis(n1, n2)bray_curtis(n1, n2)
n1 |
abundances of species at site 1 |
n2 |
abundances of species at site 2 |
Bray-Curtis dissimilarity (0..1, 0 = equal, 1 = different)
species in n1 and n2 need to be aligned
n1 <- c(11, 0, 7, 8, 0) n2 <- c(24, 37, 5, 18, 1) bray_curtis(n1, n2)n1 <- c(11, 0, 7, 8, 0) n2 <- c(24, 37, 5, 18, 1) bray_curtis(n1, n2)
The ecological quality ratio is the ratio beween a parameter value and its reference value:
Depending on bad and ref, the EQR usually
(but not necessarily!) varies between 0 (bad ecological quality) and 1 (
ecological quality equals the reference status).
eqr(x, bad, ref)eqr(x, bad, ref)
x |
numeric vector containing benthic indices |
bad |
the value for a bad status |
ref |
the value for a reference status |
numeric vector with EQR-values: low values indicate bad ecological quality and high values indicate good ecological quality.
This algorithm reallocates the counts of taxa, that are only identified at the genus level to taxa in the same sampling unit and of the same genus but that are identified on the species level. The redistribution of counts is proportional to the number of counts at the species level.
genus_to_species(is_genus, count)genus_to_species(is_genus, count)
is_genus |
|
count |
|
numeric vector with updated counts. The counts for the
taxon on the genus level have been set to zero.
Parameters is_genus and count are of the same length and
correspond to the same taxon.
The resulting counts are not necessarily integers.
genus_to_species(is_genus = c(TRUE, FALSE, FALSE), count = c(3, 10, 20)) genus_to_species(is_genus = c(TRUE, FALSE, FALSE), count = c(1, 10, 20))genus_to_species(is_genus = c(TRUE, FALSE, FALSE), count = c(3, 10, 20)) genus_to_species(is_genus = c(TRUE, FALSE, FALSE), count = c(1, 10, 20))
This function gets sensitivity groups that are supplementary to the AMBI of Borja et al., (2000)
get_ambi(which = "NL")get_ambi(which = "NL")
which |
which AMBI supplement? Currently only the Dutch supplement is
available ( |
a data frame with columns TAXON containing taxa and
GROUP containing Dutch AMBI-groups
Borja, A., J. Franco and V. Perez, 2000. A Marine Biotic Index to Establish the Ecological Quality of Soft-Bottom Benthos Within European Estuarine and Coastal Environments. Marine Pollution Bulletin 40:1100-1114
This function gets the sensitivity groups to estimate the infaunal trophic index of Gittenberger et al., (2011)
get_iti()get_iti()
a data frame with columns TAXON containing taxa and
GROUP containing the ITI-groups of Gittenberger & Van Loon (2013).
Gittenberger A. and W. van Loon, 2013. Sensitivities of marine macrozoobenthos to environmental pressures in the Netherlands. Nederlandse Faunistische Mededelingen 41: 79-112.
Convert text to the most occuring case. In case of ties, the first occurence in sorted order will be taken.
harmonize(x)harmonize(x)
x |
character vector |
character vector with harmonized names (i.e., same case)
x <- c("FOO", "Foo", "bar", "FOO", "bar", "FOO", "Bar") y <- harmonize(x) stopifnot(all.equal(y, c("FOO", "FOO", "bar", "FOO", "bar", "FOO", "bar")))x <- c("FOO", "Foo", "bar", "FOO", "bar", "FOO", "Bar") y <- harmonize(x) stopifnot(all.equal(y, c("FOO", "FOO", "bar", "FOO", "bar", "FOO", "bar")))
According to Hill (1973): "a diversity number is figuratively a
measure of how many species are present if we examine the sample down to a
certain depth among its rarities. If we examine superficially (e.g.,
by using ) we shall see only the more abundant species. If we
look deeply (e.g., by using ) we shall see all the
species present."
hill(taxon, count, a = 0) hill0(taxon, count) hill1(taxon, count) hill2(taxon, count)hill(taxon, count, a = 0) hill0(taxon, count) hill1(taxon, count) hill2(taxon, count)
taxon |
character vector containing taxa |
count |
numeric vector containing counts |
a |
exponent in Hill's diversity number (R, with special cases for
|
Hill's diversity numbers are given by:
Special cases are:
reciprocal of the proportional abundance of the rarest species;
total number of species present;
exp(H), where H: Shannon's index (see also
shannon);
reciprocal of Simpson's index (see also
simpson);
reciprocal of the proportional abundance of the commonest species.
numeric vector of Hill's numbers
hill0():
hill1():
hill2():
Hill, M.O., 1973. Diversity and Evenness: A Unifying Notation and Its Consequences. Ecology 54:427-432
species_richness, shannon,
simpson
hill( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12), a = 0 ) hill0( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12) )hill( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12), a = 0 ) hill0( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12) )
The probability that two individuals selected at random (without replacement) from a sample will belong to different species is given by (Hurlbert, 1971, p.579, Eq. 3):
where (Hurlbert, 1971, p.579, Eq. 4) is the
probability that two individuals selected at random (with
replacement) from a sample will belong to different species:
where is the number of individuals of the ith
species in the community, is the total number of individuals in the
community, , and is the number of
species in the community.
Note that Hurlbert's PIE hpie is the complement of
simpson.
hpie(taxon, count)hpie(taxon, count)
taxon |
character vector containing taxa |
count |
numeric vector containing counts |
A numeric vector with the probability of interspecific encounter (PIE).
Hurlbert, S.H., 1971. The Nonconcept of Species Diversity: A Critique and Alternative Parameters. Ecology 52:577-586.
hpie( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12) )hpie( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12) )
The expected number of species in a sample of n individuals:
hurlbert(taxon, count, n = 100L)hurlbert(taxon, count, n = 100L)
taxon |
character vector containing taxa |
count |
numeric vector containing counts |
n |
number of individuals in a standard sample |
expected number of species in a sample of n individuals
Hurlbert, S.H., 1971. The Nonconcept of Species Diversity: A Critique and Alternative Parameters. Ecology 52:577-586.
hurlbert( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6), n = 8 )hurlbert( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6), n = 8 )
Case-insensitive test for taxa starting with 'azoi'
is_azoic(x)is_azoic(x)
x |
character vector containing taxa |
Azoic samples need special attention during data analysis. They should be marked as 'azoic', and taken care of during analysis. Note that an azoic sample is not the same as a record where a taxon has zero counts. The latter should be removed from further analysis, whereas the former provides important information.
logical vector, with elements TRUE for azoic samples,
and FALSE otherwise.
is_binomial tests for valid binomial names,
generic_name extracts the genus to which the species belongs,
specific_name extracts the species within the genus.
is_binomen(x) generic_name(x) specific_name(x) strip_sp(x)is_binomen(x) generic_name(x) specific_name(x) strip_sp(x)
x |
|
character vector with either the generic name or the specific name of the species.
generic_name(): extracts the genus to which the species belongs
specific_name(): extracts the species within the genus
strip_sp(): strips postfix sp. or spp. from a binomen
is_binomen("Venerupis corrugata") # TRUE generic_name("Venerupis corrugata") # Venerupis specific_name("Venerupis corrugata") # corrugata generic_name("venerupis corrugata") # NA (genus part should be capitalized)is_binomen("Venerupis corrugata") # TRUE generic_name("Venerupis corrugata") # Venerupis specific_name("Venerupis corrugata") # corrugata generic_name("venerupis corrugata") # NA (genus part should be capitalized)
Computes the Infaunal Trophic Index (ITI) according to Gittenberger & van Loon (2013).
iti(taxon, count, group = NULL) has_iti(taxon, group = NULL)iti(taxon, count, group = NULL) has_iti(taxon, group = NULL)
taxon |
species names |
count |
counts of individuals ( |
group |
sensitivity groups I, II, III, or IV |
The Infaunal Trophic Index (ITI) is given by
where is the proportion of species in class , where
group I are suspension feeders (highest quality);
group II are interface feeders
group III are surface deposit feeders and
group IV are subsurface deposit feeders (lowest quality).
numeric vector of length 1 containing the ITI
has_iti(): tests if an ITI sensitivity group is available for
taxon (returns TRUE (available) or
FALSE (unavailable))
Gittenberger A. and W. van Loon, 2013. Sensitivities of marine macrozoobenthos to environmental pressures in the Netherlands. Nederlandse Faunistische Mededelingen 41: 79-112.
iti(taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6))iti(taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6))
Margalef Index of Diversity is given by
margalef(taxon, count)margalef(taxon, count)
taxon |
taxa names ( |
count |
counts ( |
For , the index is set to 0.
Margalef diversity index (numeric vector of length 1)
margalef( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )margalef( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )
MWTL North Sea Bentos Data
northseanorthsea
An object of class tbl_df (inherits from tbl, data.frame) with 24983 rows and 9 columns.
Oosterschelde data set. The Oosterschelde is located in the southwest of the Netherlands.
oosterscheldeoosterschelde
An object of class tbl_df (inherits from tbl, data.frame) with 4269 rows and 8 columns.
The Oosterschelde data contains the following columns:
ID sample identifier
HABITAT specification of the habitat
AREA sampled area
DATE sampling date (YYYY-MM-DD, ISO 8601)
TAXON standardized taxon code (see WoRMS-website https://www.marinespecies.org/)
COUNT number of individuals of 'TAXON'
This is not the original data set, but a simplified version of it meant for didactic purposes only! For instance it only contains taxa identified at the species level. Other taxa have been removed.
Rijkswaterstaat Water, Transport and Living Environment, Department of Information Management, Lelystad, The Netherlands (contact: [email protected])
This function randomly assigns samples to pools of approximately equal area
pool(sample_id = seq_along(area), area, target_area, max_try = 100L) .pool(sample_id = seq_along(area), area, target_area, max_try = 100L)pool(sample_id = seq_along(area), area, target_area, max_try = 100L) .pool(sample_id = seq_along(area), area, target_area, max_try = 100L)
sample_id |
sample identifier |
area |
sampling area of |
target_area |
vector of length 2 containing the lower and upper bound
of the pooled area (same units as |
max_try |
maximum number of unsuccessful pooling tries before the algorithm gives up. |
vector with idenitifiers (integers) indicating the pool to which each sample belongs (NA for samples that could not be pooled)
.pool(): internal function not supposed to be called directly.
This function reads and checks files with AMBI sensitivity data. The data should be stored in 'comma separated values' format (csv) consisting of two columns:
species name;
Roman numeral (I, II, III, IV, V) giving the sensitivity group
read_ambi(filename) validate_ambi(x)read_ambi(filename) validate_ambi(x)
filename |
name of the AMBI sensitivity file (character) |
x |
table in AMBI-format |
The function performs the following tasks:
checks the existence of filename;
checks availability of required columns (case insensitive);
removes redundant spaces;
removes duplicated records.
validate_ambi(): validator for AMBI-format
Borja, A., J. Franco and V. Perez, 2000. A Marine Biotic Index to Establish the Ecological Quality of Soft-Bottom Benthos Within European Estuarine and Coastal Environments. Marine Pollution Bulletin 40:1100-1114
This function reads and checks BEQI2 input files. The format has been specified in Van Loon (2013) and is described in the vignette of the BENMMI-package.
read_beqi2(filename) validate_beqi2(x)read_beqi2(filename) validate_beqi2(x)
filename |
name of BEQI2 input file ( |
x |
table in BEQI2-format |
The function performs the following tasks:
checks the existence of filename;
checks availablitity of required columns (case insensitive);
make column names with aggregation data case-insensitive;
removes redundant spaces;
checks if DATE-field adheres to ISO 8601 (YYYY-mm-dd);
constructs a unique identifier ID by concatenating
columns OBJECTID and DATE;
checks that each ID has a unique AREA;
checks azoic samples for VALUE=0;
removes records with VALUE=0, not belonging to azoic samples;
checks VALUE-field on missing values;
checks if VALUE-field is an integer;
validate_beqi2(): validator for BEQI2-format
Willem van Loon, 2013. BEQI2 INPUT FORMAT. See the package-vignette of the BENMMI-package.
This function reads and checks files containing Infaunal Trophic Index (ITI) data (Gittenberger & Van Loon, 2013)
read_iti(filename) validate_iti(x)read_iti(filename) validate_iti(x)
filename |
name of the ITI file (character). |
x |
table in ITI-format |
The function performs the following tasks:
checks the existence of filename;
checks availability of required columns (case insensitive), i.e., TAXON and GROUP;
removes redundant spaces;
removes duplicated records;
checks if all ITI classes are I, II, III, or IV
The column 'GROUP' contains the Roman numerals I, II, III, and IV, with the following meaning:
suspension feeders;
interface feeders;
surface deposit feeders;
subsurface deposit feeders.
A data frame with columns TAXON containing taxa and
GROUP containing user-defined ITI-groups
(see Gittenberger & Van Loon, 2013).
validate_iti(): validator for ITI-format
Gittenberger A. and W. van Loon, 2013. Sensitivities of marine macrozoobenthos to environmental pressures in the Netherlands. Nederlandse Faunistische Mededelingen 41: 79-112.
This function reads and checks files with reference values
read_ref(filename, indicators = c("S", "H", "AMBI")) validate_ref(x, indicators = c("S", "H", "AMBI"))read_ref(filename, indicators = c("S", "H", "AMBI")) validate_ref(x, indicators = c("S", "H", "AMBI"))
filename |
name of the habitat reference file ( |
indicators |
indicators to be processed ( |
x |
table in REF-format |
The function performs the following tasks:
checks the existence of filename;
checks availablitity of required columns (case insensitive);
removes redundant spaces
removes duplicated records
Argument indicators is a character vector of additional benthic
indicators to be checked for. For example, if indicators = "ITI", then
the habitat reference file should also contain columns ITIREF and ITIBAD.
Implemented indicators are N, LNN, S, D, SN, SNA, H, L, AMBI, ITI, PIE, N2
(see package vignette).
The format of the habitat reference file is documented in the BEQI2-package vignette.
validate_ref(): validator for REF-format
Van Loon, W, 2013. Loon2013-BEQI2-Specs-Ecotopes-27nov.doc
This function reads files in the taxa format.
read_taxa(filename) get_taxa() validate_taxa(x)read_taxa(filename) get_taxa() validate_taxa(x)
filename |
name of taxa file |
x |
table in taxa-format |
Taxa files have the following format:
taxonomic group
provided taxon name
accepted taxon name
taxonomic level
Other columns are allowed, but silently ingored.
get_taxa(): get default taxa list (TWN list extended with species
Southern North Sea)
validate_taxa(): validator for taxa-format
This function reads files in the Taxa Waterbeheer Nederland (TWN) format.
read_twn(filename) get_worms() validate_twn(x)read_twn(filename) get_worms() validate_twn(x)
filename |
name of TWN file ( |
x |
table in TWN-format |
The function adds a new column taxon. Its contents depending
on TWN-status:
taxonname
prefername
parentname
a tibble with four columns:
TWN/WoRMS taxon group
TWN/WoRMS taxon level
taxon name to convert from
taxon name to convert to
get_worms(): get default WoRMS list (TWN list extended with species
Southern North Sea)
validate_twn(): validator for TWN-format
Rygg's index of diversity is given by
rygg(taxon, count, adjusted = FALSE)rygg(taxon, count, adjusted = FALSE)
taxon |
taxa names ( |
count |
counts ( |
adjusted |
(defaults to |
The adjusted version of Rygg's index which gives more consistent values
for smaller S=2, N=2, N=3 and S=3, N=3 is
Rygg's index of diversity (numeric vector of length 1)
Rygg's index is not defined for . For
, rygg returns
NA_real_.
Rygg, B. (2006). Developing indices for quality-status classification of marine soft-bottom fauna in Norway. Norwegian Institute for Water Research, Oslo, Norway. NIVA Report SNO 5208-2006.
rygg( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )rygg( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )
Compute entropy according to Shannon (1948)
shannon(taxon, count, base = 2)shannon(taxon, count, base = 2)
taxon |
taxa names ( |
count |
counts ( |
base |
the base with respect to which logarithms are computed. Defaults to 2 (unit: bits). |
Shannon's entropy
Shannon, C. E., 1948. A Mathematical Theory of Communication. Bell System Technical Journal 27: 379-423.
shannon( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )shannon( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )
The probability that two individuals selected at random (with replacement, Hurlbert, 1971, p.579) from a sample will belong to the same species. For an infinite sample Simpson's Index is given by (Peet, 1974):
For a finite sample by:
where the proportion of the individuals in species ,
the number of individuals in species
(relative abundance), and the total number
of individuals (total_abundance). The finite sample case
has been implemented in function simpson (and simpson_).
simpson(taxon, count)simpson(taxon, count)
taxon |
character vector containing taxa |
count |
numeric vector containing counts |
The probability that two individuals selected at random from a sample will belong to the same species.
Peet, R. K. 1974, The Measurement of Species Diversity. Annual Review of Ecology and Systematics 5:285-307.
simpson( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12) )simpson( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(6, 12) )
Species richness () is defined as the number of taxa
(lowest identification level possible) per sampling unit
(data pool or box core sample).
species_richness(taxon, count = NULL)species_richness(taxon, count = NULL)
taxon |
taxa names ( |
count |
number of individuals for each taxon ( |
species richness (integer vector of length 1)
species_richness( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )species_richness( taxon = c("Euspira pulchella", "Nephtys cirrosa"), count = c(4, 6) )
This function removes redundant spaces from character vectors
strip_spaces(x)strip_spaces(x)
x |
character vector |
character vector without trailing or multiple spaces
Taxon names are standardized according to the World Register of Marine Species (WoRMS) database. The conversion is case-insensitive. For this conversion, the TWN-list (Taxa Water management the Netherlands) is used, extended with species of the Southern North Sea. See references below for download locations.
to_worms(taxon, worms = NULL) is_worms(.data = NULL, taxon) is_worms_(.data, taxon) is_accepted(taxon)to_worms(taxon, worms = NULL) is_worms(.data = NULL, taxon) is_worms_(.data, taxon) is_accepted(taxon)
taxon |
|
worms |
an optional table usually created with |
.data |
data in a |
character vector with WoRMS compliant species names
TRUE for WoRMS compliant species names,
FALSE otherwise.
TRUE for WoRMS/TWN compliant species names,
FALSE otherwise.
is_worms(): check if a taxon complies with WoRMS
is_worms_(): as is_worms but suitable for calling from a
function (see package lazyeval).
is_accepted(): check if a taxon complies with WoRMS/TWN
https://www.marinespecies.org/
The total number of individuals.
total_abundance(count, na.rm = FALSE) lnn(count, na.rm = FALSE)total_abundance(count, na.rm = FALSE) lnn(count, na.rm = FALSE)
count |
counts ( |
na.rm |
Should missing values (including |
total number of individuals (integer)
lnn(): natural log of total abundance + 1
total_abundance(count = c(4, 6))total_abundance(count = c(4, 6))