View source: R/qc_taxa_values_character.R
| qc_taxa_values_character | R Documentation |
Performs basic QC of a character column against a list of accepted values.
qc_taxa_values_character(
data,
col_vals = NULL,
valid_vals = NULL,
separator = NULL
)
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 |
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,
A data frame with col_vals values, occurrence (n), and if valid (TRUE/ FALSE). Any missing valid_vals are appended.
# 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 = ",")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.