knitr::opts_chunk$set( collapse = TRUE, eval = TRUE, echo = TRUE, comment = "#>" )
The package forcis
provides functions to homogenize FORCIS data and compute abundances, concentrations, and frequencies of foraminifera counts.
This vignette shows how to use these functions.
The FORCIS database includes counts of foraminifera species collected with multiple devices. These counts are reported in different formats:
The functions detailed in this vignette allow users to convert counts between the following formats Raw abundance, Relative abundance and Number concentration.
NOTE: FORCIS data from Sediment traps and the CPR North are not supported by these functions.
First, let's attach the required package.
library(forcis)
Before proceeding, let's download the latest version of the FORCIS database.
# Create a data/ folder ---- dir.create("data") # Download latest version of the database ---- download_forcis_db(path = "data", version = NULL)
The vignette will use the plankton net data of the FORCIS database. Let's import the latest release of the data.
file_name <- system.file(file.path("extdata", "FORCIS_net_sample.csv"), package = "forcis") net_data <- read.table(file_name, dec = ".", sep = ";")
# Import net data ---- net_data <- read_plankton_nets_data(path = "data")
NB: In this vignette, we use a subset of the plankton net data, not the whole dataset.
After importing the data, the initial step involves choosing the taxonomic level for the analyses, (the different taxonomic levels are described in this data paper).
Let's use the function select_taxonomy()
to select the VT taxonomy (validated taxonomy):
# Select taxonomy ---- net_data <- select_taxonomy(net_data, taxonomy = "VT")
Once the data contain counts from the same taxonomic level, we can proceed with the conversion functions: compute_*()
.
The functions accept two arguments: the input data
and the aggregate
arguments. If aggregate = TRUE
, the function will return the transformed counts of each species using the sample as the unit. If aggregate = FALSE
, it will re-calculate the species' abundance by subsample.
compute_abundances()
This function converts all counts into raw abundances, using sampling metadata such as sample volume and total assemblage counts. It calculates the raw abundance for each taxon whose counts are reported as either relative abundance or number concentrations.
# Convert species counts in raw abundance ---- net_data_raw_ab <- compute_abundances(net_data, aggregate = TRUE)
# Format ---- dim(net_data) dim(net_data_raw_ab) # Header ---- net_data_raw_ab <- as.data.frame(net_data_raw_ab) head(net_data_raw_ab)
The functions compute_*()
output a table in a long-format as well as a message reporting the amount of data that could not be converted because of missing metadata.
compute_concentrations()
This function transforms all counts into number concentration abundances. It also leverages sampling metadata such as sample volume and total assemblage counts to compute the number concentration for each species.
# Convert species counts in number concentration ---- net_data_n_conc <- compute_concentrations(net_data, aggregate = TRUE)
compute_frequencies()
This function computes relative abundance for each species using total assemblage counts when available.
# Convert species counts in relative abundance ---- net_data_rel_ab <- compute_frequencies(net_data, aggregate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.