computations: Compute count conversions

compute_abundancesR Documentation

Compute count conversions

Description

Functions to convert species counts between different formats: raw abundance, relative abundance, and number concentration, using counts metadata.

Usage

compute_abundances(data, aggregate = TRUE)

compute_concentrations(data, aggregate = TRUE)

compute_frequencies(data, aggregate = TRUE)

Arguments

data

a data.frame. One obtained by ⁠read_*_data()⁠ functions.

aggregate

a logical of length 1. If FALSE counts will be derived for each subsample. If TRUE (default) subsample counts will be aggregated by sample_id.

Details

  • compute_concentrations() converts all counts to number concentrations (n specimens/m³).

  • compute_frequencies() converts all counts to relative abundances (% specimens per sampling unit).

  • compute_abundances() converts all counts to raw abundances (n specimens/sampling unit).

Value

A data.frame in long format with two additional columns: taxa, the taxon name and ⁠counts_*⁠, the number concentration (counts_n_conc) or the relative abundance (counts_rel_ab) or the raw abundance (counts_raw_ab).

Examples

# Import example dataset ----
file_name <- system.file(file.path("extdata", "FORCIS_net_sample.csv"), 
                         package = "forcis")

net_data <- read.table(file_name, dec = ".", sep = ";")

# Add 'data_type' column ----
net_data$"data_type" <- "Net"

# Select a taxonomy ----
net_data <- select_taxonomy(net_data, taxonomy = "VT")

# Dimensions of the data.frame ----
dim(net_data)

# Compute concentration ----
net_data_conc <- compute_concentrations(net_data)

# Dimensions of the data.frame ----
dim(net_data_conc)

FRBCesab/forcis documentation built on Oct. 25, 2024, 9:26 a.m.