View source: R/checkMWRfrecom.R
checkMWRfrecom | R Documentation |
Check data quality objective frequency and completeness data
checkMWRfrecom(frecomdat, warn = TRUE)
frecomdat |
input data frame |
warn |
logical to return warnings to the console (default) |
This function is used internally within readMWRfrecom
to run several checks on the input data for frequency and completeness and conformance to WQX requirements
The following checks are made:
Column name spelling: Should be the following: Parameter, Field Duplicate, Lab Duplicate, Field Blank, Lab Blank, Spike/Check Accuracy, % Completeness
Columns present: All columns from the previous check should be present
Non-numeric values: Values entered in columns other than the first should be numeric
Values outside of 0 - 100: Values entered in columns other than the first should not be outside of 0 and 100
Parameter: Should match parameter names in the Simple Parameter
or WQX Parameter
columns of the paramsMWR
data
Empty columns: Columns with all missing or NA values will return a warning
frecomdat
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.
library(dplyr)
frecompth <- system.file('extdata/ExampleDQOFrequencyCompleteness.xlsx',
package = 'MassWateR')
frecomdat <- suppressMessages(readxl::read_excel(frecompth,
skip = 1, na = c('NA', 'na', ''),
col_types = c('text', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric')
)) %>%
rename(`% Completeness` = `...7`)
checkMWRfrecom(frecomdat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.