From 0c4cd69abd3957faeeb3e0e5b90e0256e7b1a67c Mon Sep 17 00:00:00 2001 From: fawda123 Date: Fri, 3 Nov 2023 09:24:25 -0400 Subject: [PATCH] fix to multiple value ranges as ascending for checkMWRacc, remove check for more than two rows per parmaeter, #63 --- R/checkMWRacc.R | 13 +------------ man/checkMWRacc.Rd | 3 +-- tests/testthat/test-checkMWRacc.R | 6 ------ vignettes/inputs.Rmd | 3 +-- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/R/checkMWRacc.R b/R/checkMWRacc.R index 6a7d2f26..1f7a2027 100644 --- a/R/checkMWRacc.R +++ b/R/checkMWRacc.R @@ -12,8 +12,7 @@ #' \item Column types: All columns should be characters/text, except for MDL and UQL #' \item \code{Value Range} column na check: The character string \code{"na"} should not be in the \code{Value Range} column, \code{"all"} should be used if the entire range applies #' \item Unrecognized characters: Fields describing accuracy checks should not include symbols or text other than \eqn{<=}, \eqn{\leq}, \eqn{<}, \eqn{>=}, \eqn{\geq}, \eqn{>}, \eqn{\pm}, \code{"\%"}, \code{"BDL"}, \code{"AQL"}, \code{"log"}, or \code{"all"} -#' \item Number of rows per parameter in \code{Value Range}: Should not exceed two -#' \item Overlap in \code{Value Range} column: Entries in \code{Value Range} should not overlap for a parameter +#' \item Overlap in \code{Value Range} column: Entries in \code{Value Range} should not overlap for a parameter (excludes ascending ranges) #' \item Gap in \code{Value Range} column: Entries in \code{Value Range} should not include a gap for a parameter, warning only #' \item Parameter: Should match parameter names in the \code{Simple Parameter} or \code{WQX Parameter} columns of the \code{\link{paramsMWR}} data #' \item Units: No missing entries in units (\code{uom}), except pH which can be blank @@ -120,16 +119,6 @@ checkMWRacc <- function(accdat, warn = TRUE){ } message(paste(msg, 'OK'), domain = NA) - # Number of rows per parameter - msg <- '\tChecking number of rows per parameter...' - chk <- table(accdat$Parameter) - chk <- chk <= 2 - if(any(!chk)){ - tochk <- names(chk)[!chk] - stop(msg, '\n\tMore than two rows: ', paste(tochk, collapse = ', '), call. = FALSE) - } - message(paste(msg, 'OK')) - # check overlap in value range msg <- '\tChecking overlaps in Value Range...' typ <- utilMWRvaluerange(accdat) diff --git a/man/checkMWRacc.Rd b/man/checkMWRacc.Rd index c4374e25..7d7f37c2 100644 --- a/man/checkMWRacc.Rd +++ b/man/checkMWRacc.Rd @@ -28,8 +28,7 @@ The following checks are made: \item Column types: All columns should be characters/text, except for MDL and UQL \item \code{Value Range} column na check: The character string \code{"na"} should not be in the \code{Value Range} column, \code{"all"} should be used if the entire range applies \item Unrecognized characters: Fields describing accuracy checks should not include symbols or text other than \eqn{<=}, \eqn{\leq}, \eqn{<}, \eqn{>=}, \eqn{\geq}, \eqn{>}, \eqn{\pm}, \code{"\%"}, \code{"BDL"}, \code{"AQL"}, \code{"log"}, or \code{"all"} -\item Number of rows per parameter in \code{Value Range}: Should not exceed two -\item Overlap in \code{Value Range} column: Entries in \code{Value Range} should not overlap for a parameter +\item Overlap in \code{Value Range} column: Entries in \code{Value Range} should not overlap for a parameter (excludes ascending ranges) \item Gap in \code{Value Range} column: Entries in \code{Value Range} should not include a gap for a parameter, warning only \item Parameter: Should match parameter names in the \code{Simple Parameter} or \code{WQX Parameter} columns of the \code{\link{paramsMWR}} data \item Units: No missing entries in units (\code{uom}), except pH which can be blank diff --git a/tests/testthat/test-checkMWRacc.R b/tests/testthat/test-checkMWRacc.R index 1d00367b..dfc6a2c4 100644 --- a/tests/testthat/test-checkMWRacc.R +++ b/tests/testthat/test-checkMWRacc.R @@ -34,12 +34,6 @@ test_that("Checking for text other than <=, \u2264, <, >=, \u2265, >, \u00b1, %, expect_error(checkMWRacc(chk), regexp = 'Unrecognized text in columns: Value Range, Field Duplicate', fixed = T) }) -test_that("Checking for more than two rows per parameter", { - chk <- accdatchk - chk <- bind_rows(accdatchk, accdatchk[8,], accdatchk[6,]) - expect_error(checkMWRacc(chk), regexp = 'More than two rows: Sp Conductance, TP', fixed = T) -}) - test_that("Checking overlap in value range", { chk <- accdatchk chk$`Value Range`[11] <- '<60' diff --git a/vignettes/inputs.Rmd b/vignettes/inputs.Rmd index 86de7fa6..b250b1e0 100644 --- a/vignettes/inputs.Rmd +++ b/vignettes/inputs.Rmd @@ -174,8 +174,7 @@ File checks for accuracy: - **Column types**: All columns should be characters/text, except for MDL and UQL - **`Value Range` column na check**: The character string `"na"` should not be in the `Value Range` column, `"all"` should be used if the entire range applies - **Unrecognized characters**: Fields describing accuracy checks should not include symbols or text other than $<=$, $\leq$, $<$, $>=$, $\geq$, $>$, $\pm$ `"\%"`, `"BDL"`, `"AQL"`, `"log"`, or `"all"` -- **Number of rows per parameter**: Should not exceed two -- **Overlap in `Value Range` column**: Entries in `Value Range` should not overlap for a parameter +- **Overlap in `Value Range` column**: Entries in `Value Range` should not overlap for a parameter (excludes ascending ranges) - **Gap in `Value Range` column**: Entries in `Value Range` should not include a gap for a parameter, warning only - **Parameter**: Should match parameter names in the `Simple Parameter` or `WQX Parameter` columns of the `paramsMWR` data - **Units**: No missing entries in units (`uom`), except pH which can be blank