Title: | Benthic Multi-Metric Index |
---|---|
Description: | Analysis tool for evaluating benthic multimetric indices (BENMMIs). It generates reproducible reports on the analysis of benthic data, e.g., validation and correction of species names, sample pooling, automatic conversion of genus to species names, outlier detection, benthic indicator calculation, optimization of single and multimetric indicators against a pressure gradient, and spatial aggregation of benthic indicators. One of its use cases was the development of a common benthic indicator for <https://www.ospar.org> (publication accepted by Ecological Indicators). See Van Loon et al. (2018) <doi:10.1016/j.ecolind.2017.09.029> for details. |
Authors: | Dennis Walvoort [aut, cre], Willem van Loon [aut, cph] |
Maintainer: | Dennis Walvoort <[email protected]> |
License: | GPL (>= 3) |
Version: | 4.3-7 |
Built: | 2024-10-27 09:15:30 UTC |
Source: | https://github.com/cranhaven/cranhaven.r-universe.dev |
This function performs a complete BENMMI analysis following the
settings provided in filename
.
benmmi(filename = NULL, tmpdir = tempfile(pattern = "BENMMI"), browse = TRUE) BENMMI(filename = NULL, tmpdir = tempdir(), browse = TRUE)
benmmi(filename = NULL, tmpdir = tempfile(pattern = "BENMMI"), browse = TRUE) BENMMI(filename = NULL, tmpdir = tempdir(), browse = TRUE)
filename |
name of the JSON file defining all analysis steps. |
tmpdir |
directory to store temporary files (for debugging only) |
browse |
load resulting report in a browser? |
# This example illustrates a typical use case of the BENMMI-package. # Note: execution may take several minutes. # See the package vignette for more advanced examples and details. if (interactive()) { # Create a work directory (in this example, a temporary # directory, but in real use cases a persistent directory # will obviously be more useful). my_dir <- tempfile("benmmi-example") dir.create(my_dir) # Populate this directory with simple use cases # (see the package-vignette for details). # Most users will probably use one of these use cases as a # template for their own study. BENMMIdir(my_dir) # Run BENMMI given the settings in "settings-S-D-lin.json". This file # relates to one of the predefined use cases. my_settings_file <- file.path(my_dir, "settings-S-D-lin.json") benmmi(my_settings_file, browse = FALSE) # The output (HTML-report and data-files) is stored in 'my_dir' # and described in the package-vignette and resulting HTML-report itself. # It is also possible to directly view the generated # HTML-report by setting the browse-argument of the benmmi-function to TRUE. }
# This example illustrates a typical use case of the BENMMI-package. # Note: execution may take several minutes. # See the package vignette for more advanced examples and details. if (interactive()) { # Create a work directory (in this example, a temporary # directory, but in real use cases a persistent directory # will obviously be more useful). my_dir <- tempfile("benmmi-example") dir.create(my_dir) # Populate this directory with simple use cases # (see the package-vignette for details). # Most users will probably use one of these use cases as a # template for their own study. BENMMIdir(my_dir) # Run BENMMI given the settings in "settings-S-D-lin.json". This file # relates to one of the predefined use cases. my_settings_file <- file.path(my_dir, "settings-S-D-lin.json") benmmi(my_settings_file, browse = FALSE) # The output (HTML-report and data-files) is stored in 'my_dir' # and described in the package-vignette and resulting HTML-report itself. # It is also possible to directly view the generated # HTML-report by setting the browse-argument of the benmmi-function to TRUE. }
Reporting tool for a benthic multimetric indicator
Dennis Walvoort (Wageningen University & Research) & Willem van Loon (Rijkswaterstaat-The Netherlands)
Creates a BENMMI-directory structure and populates it with some relevant BENMMI-files. Users may wish to modify this directory structure and add their own data.
BENMMIdir(path = NULL)
BENMMIdir(path = NULL)
path |
name of an exisiting directory. This directory should be empty to prevent loss of data. If missing, a dialogue will appear. |
Mean and Confidence Interval
ci_mean(x, level = 0.9)
ci_mean(x, level = 0.9)
x |
numeric vector |
level |
confidence level |
Internal function. Not supposed to be called directly
stopifnot(all.equal(ci_mean(NA_real_), c(NA_real_, NA_real_, NA_real_))) stopifnot(all.equal(ci_mean(1), c(lower = NA_real_, mean = 1, upper = NA_real_))) stopifnot(all.equal( ci_mean(1:9, 0.95), c(lower = 2.934942, mean = 5.000000, upper = 7.065058), tolerance = 0.0001) )
stopifnot(all.equal(ci_mean(NA_real_), c(NA_real_, NA_real_, NA_real_))) stopifnot(all.equal(ci_mean(1), c(lower = NA_real_, mean = 1, upper = NA_real_))) stopifnot(all.equal( ci_mean(1:9, 0.95), c(lower = 2.934942, mean = 5.000000, upper = 7.065058), tolerance = 0.0001) )
This function reads and checks benthos files. The format is a superset of the BEQI2-format as specified in Van Loon (2013). In addition to the BEQI2-format, the benthos-format also includes columns latitude (LAT), longitude (LONG), and sieve mesh size (MESH).
read_mmi(filename)
read_mmi(filename)
filename |
name of benthos file ( |
Willem van Loon, 2013. BEQI2 INPUT FORMAT
This function reads BENMMI settings files. See the package vignette
for a description of its format. Create an example file by
calling the BENMMIdir
-function.
read_settings(filename)
read_settings(filename)
filename |
name of BENMMI input file ( |
The function performs the following tasks:
checks the existence of filename
;
reads JSON file while ignoring C-style comments;
checks avaiability of required keys in the JSON-file
checks values in JSON-file
Construct a Text Representation of a Weight Vector
toString_weights(x)
toString_weights(x)
x |
numeric or character vector |
Internal function. Not supposed to be called directly