Data conversion

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.

Count formats

The FORCIS database includes counts of foraminifera species collected with multiple devices. These counts are reported in different formats:

  • Raw abundance: number of specimens counted within a sampling unit.
  • Number concentration: number of specimens per cubic meter.
  • Relative abundance: percentage of specimens relative to the total counted.
  • Fluxes: number of specimens per square meter per day.
  • Binned counts: number of specimens categorized into a specific range (minimum and maximum) within a sampling unit.

Conversion functions

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.

# 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)
#> Counts from 26 samples could not be converted because of missing volume data
#> Relative counts from 24 samples could not be converted because of missing data on total assemblage
# Format ----
dim(net_data)
#> [1] 2451   77
dim(net_data_raw_ab)
#> [1] 39032    16

# Header ----
net_data_raw_ab <- as.data.frame(net_data_raw_ab)
head(net_data_raw_ab)
#>   data_type    cruise_id            profile_id sample_id sample_min_depth
#> 1       Net RinaldoDohrn L20_RinaldoDohrn_10_1  L20_10_1                0
#> 2       Net RinaldoDohrn L20_RinaldoDohrn_10_1  L20_10_1                0
#> 3       Net RinaldoDohrn L20_RinaldoDohrn_10_1  L20_10_1                0
#> 4       Net RinaldoDohrn L20_RinaldoDohrn_10_1  L20_10_1                0
#> 5       Net RinaldoDohrn L20_RinaldoDohrn_10_1  L20_10_1                0
#> 6       Net RinaldoDohrn L20_RinaldoDohrn_10_1  L20_10_1                0
#>   sample_max_depth profile_depth_min profile_depth_max profile_date_time
#> 1               20                 0               300        09/04/1979
#> 2               20                 0               300        09/04/1979
#> 3               20                 0               300        09/04/1979
#> 4               20                 0               300        09/04/1979
#> 5               20                 0               300        09/04/1979
#> 6               20                 0               300        09/04/1979
#>   cast_net_op_m2 sample_segment_length site_lat_start_decimal
#> 1             NA                    NA                   40.7
#> 2             NA                    NA                   40.7
#> 3             NA                    NA                   40.7
#> 4             NA                    NA                   40.7
#> 5             NA                    NA                   40.7
#> 6             NA                    NA                   40.7
#>   site_lon_start_decimal sample_volume_filtered            taxa counts_raw_ab
#> 1                  15.08                   1000   b_digitata_VT             0
#> 2                  15.08                   1000    b_pumilio_VT             0
#> 3                  15.08                   1000 b_variabilis_VT             0
#> 4                  15.08                   1000     c_nitida_VT             0
#> 5                  15.08                   1000   d_anfracta_VT             0
#> 6                  15.08                   1000     g_adamsi_VT             0

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)
#> Counts from 14 samples could not be converted because of missing volume data
#> Relative counts from 24 samples could not be converted because of missing data on total assemblage

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)
#> Counts from 12 samples could not be converted because of missing volume data
#> Counts from 0 samples could not be converted because of missing data on total assemblage