qc_taxa_values_character: QC Autecological Character Values

View source: R/qc_taxa_values_character.R

qc_taxa_values_characterR Documentation

QC Autecological Character Values

Description

Performs basic QC of a character column against a list of accepted values.

Usage

qc_taxa_values_character(
  data,
  col_vals = NULL,
  valid_vals = NULL,
  separator = NULL
)

Arguments

data

A data frame containing autecological taxa data.

col_vals

The column containing the character values to be checked.

valid_vals

Accepted values.

separator

If values should be separated and checked include a delimiter. Default = NULL

Details

Returns a data frame of the values from the input with counts (column = n) from the column and whether the values appeared in valid values (column = valid). Values in the accepted values not appearing in the input are appended to the bottom of the returned data frame. These values are marked as n = NA and valid = TRUE. If NA is a valid value it must be included in valid_vals or in the output NA will be labeled as valid = FALSE.

The default accepted values for the abbreviations are those used in the function metric.values(). See below for examples.

Function Feeding Group (FFG) CF, CG, MH, OM, PA, PI, PR, SC, SH, XY User using FC and GC over CF and CG can modify the accepted values. Both versions are accepted in metric.values().

Habit BU, CB, CN, SK, SP, SW Values separated with "," are first split apart and spaces removed before checking. Not necessary to supply all possible combinations as each part is checked against the valid values.

Life Cycle (Voltinism) MULTI, SEMI, UNI

FFG2 DD, PRE

Thermal_Indicator STENOC, COLD, COOL, WARM, STENOW, EURYTHERMAL, COWA

HabStruct CS, NF, RM, SG

Habitat BRAC, DEPO, GENE, HEAD, LENT, LOTI, RHEA, RIVE, SPEC, TERR, UNKN

Elevation LOW, HIGH

Gradient LOW, MOD, HIGH

WSArea SMALL, MEDIUM, LARGE, XLARGE

BCG_ATTR 1, 2, 3, 4, 5, 6, 1I, 4_BETTER, 4_MIDDLE, 4_WORSE, 5.5, 6I, 6M, 6T,

Value

A data frame with col_vals values, occurrence (n), and if valid (TRUE/ FALSE). Any missing valid_vals are appended.

Examples

# Values, FFG, Abr
qc_taxa_values_character(data_benthos_PacNW,
                         "FFG",
                         valid_vals = c("CF",
                                        "CG",
                                        "MH",
                                        "OM",
                                        "PA",
                                        "PH",
                                        "PI",
                                        "PR",
                                        "SC",
                                        "SH",
                                        "XY",
                                        NA))

# Values, FFG, full names
qc_taxa_values_character(data_benthos_MBSS,
                         "FFG",
                         valid_vals = c("Collector",
                                        "Filterer",
                                        "Predator",
                                        "Scraper",
                                        "Shredder"))

# Values, Habit, no separator
qc_taxa_values_character(data_benthos_MBSS,
                         "Habit",
                         valid_vals = c("bu", "cb", "cn", "dv", "sk", "sp", "sw"))

# Values, Habit, no separator
qc_taxa_values_character(data_benthos_MBSS,
                         "Habit",
                         valid_vals = c("bu", "cb", "cn", "dv", "sk", "sp", "sw"),
                         separator = ",")




BioMonTools documentation built on Aug. 5, 2026, 1:08 a.m.