checkMWRwqx | R Documentation |
Check water quality exchange (wqx) metadata input
checkMWRwqx(wqxdat, warn = TRUE)
wqxdat |
input data frame |
warn |
logical to return warnings to the console (default) |
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
or WQX Parameter
columns of the paramsMWR
data (warning only)
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.
library(dplyr)
wqxpth <- system.file('extdata/ExampleWQX.xlsx', package = 'MassWateR')
wqxdat <- readxl::read_excel(wqxpth, na = c('NA', 'na', ''), col_types = 'text')
checkMWRwqx(wqxdat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.