R/dc_validation_mindepth_greaterthan_maxdepth.R

Defines functions dc_validation_mindepth_greaterthan_maxdepth

Documented in dc_validation_mindepth_greaterthan_maxdepth

#' @rdname dc_validation_mindepth_greaterthan_maxdepth
#' 
#' @param TARGET a vector of minimumDepthInMeters.
#' @param TARGET2 a vector of maximumDepthInMeters.
#' 
dc_validation_mindepth_greaterthan_maxdepth <- function(
  TARGET = NULL,
  TARGET2 = NULL
) {
  suppressWarnings(
    result1 <- TARGET %>%
      trimws() %>%
      as.numeric()
  )
  suppressWarnings(
    result2 <- TARGET2 %>%
      trimws() %>%
      as.numeric()
  )
  result <- as.numeric(result1) <= as.numeric(result2)
  foo <- perform_dc_missing(result, TARGET)
  bar <- perform_dc_missing(result, TARGET2)
  return(foo + bar == 2)
}
bd-R/bdchecks documentation built on Oct. 8, 2021, 5:10 p.m.