checkMWRwqx {MassWateR} | R Documentation |
Check water quality exchange (wqx) metadata input
Description
Check water quality exchange (wqx) metadata input
Usage
checkMWRwqx(wqxdat, warn = TRUE)
Arguments
wqxdat |
input data frame |
warn |
logical to return warnings to the console (default) |
Details
This function is used internally within readMWRwqx
to run several checks on the input data for conformance with downstream functions
The following checks are made:
Column name spelling: Should be the following: Parameter, Sampling Method Context, Method Speciation, Result Sample Fraction, Analytical Method, Analytical Method Context
Columns present: All columns from the previous check should be present
Unique parameters: Values in
Parameter
should be unique (no duplicates)Parameter: Should match parameter names in the
Simple Parameter
orWQX Parameter
columns of theparamsMWR
data (warning only)
Value
wqxdat
is returned as is if no errors are found, otherwise an informative error message is returned prompting the user to make the required correction to the raw data before proceeding. Checks with warnings can be fixed at the discretion of the user before proceeding.
Examples
library(dplyr)
wqxpth <- system.file('extdata/ExampleWQX.xlsx', package = 'MassWateR')
wqxdat <- readxl::read_excel(wqxpth, na = c('NA', 'na', ''), col_types = 'text')
checkMWRwqx(wqxdat)