checkMWRcens: Check censored data

View source: R/checkMWRcens.R

checkMWRcensR Documentation

Check censored data

Description

Check censored data

Usage

checkMWRcens(censdat, warn = TRUE)

Arguments

censdat

input data frame for results

warn

logical to return warnings to the console (default)

Details

This function is used internally within readMWRcens to run several checks on the input data for completeness and conformance.

The following checks are made:

  • Column name spelling: Should be the following: Parameter, Missed and Censored Records

  • Columns present: All columns from the previous check should be present

  • Non-numeric or empty entries in Missed and Censored Records: All values should be numbers

  • Negative Missed and Censored Records: All values should be greater than or equal to zero

  • Parameter: Should match parameter names in the Simple Parameter or WQX Parameter columns of the paramsMWR data (warning only)

Value

censdat 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

censpth <- system.file('extdata/ExampleCensored.xlsx', package = 'MassWateR')

censdat <- suppressWarnings(readxl::read_excel(censpth, na = c('NA', 'na', ''), guess_max = Inf)) 
             
checkMWRcens(censdat)

massbays-tech/MassWateR documentation built on April 12, 2025, 7:53 p.m.