Skip to content

Commit

Permalink
fix to multiple value ranges as ascending for checkMWRacc, remove che…
Browse files Browse the repository at this point in the history
…ck for more than two rows per parmaeter, #63
  • Loading branch information
fawda123 committed Nov 3, 2023
1 parent 40139ce commit 0c4cd69
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
13 changes: 1 addition & 12 deletions R/checkMWRacc.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions man/checkMWRacc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions tests/testthat/test-checkMWRacc.R
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 1 addition & 2 deletions vignettes/inputs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c4cd69

Please sign in to comment.