validate: check consonance of an object with a suite of tests

Description Usage Arguments Value Examples

View source: R/validate.R

Description

The function always returns its primary input and should be invoked for its side effects. It stops when a data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
validate(
  x,
  suite,
  level = c(NA, "warning", "error", "stop"),
  skip = FALSE,
  skip.action = c("log", "none"),
  logging.level = c(NA, "INFO", "WARN", "ERROR", "NONE"),
  log.file = NA,
  x.name = NA,
  suite.name = NA
)

validate_inner(
  x,
  suite,
  level = NA,
  skip = FALSE,
  logging.level = NA,
  log.file = NA,
  x.name = NA,
  suite.name = NA,
  ...
)

Arguments

x

data object

suite

object of class consonance

level

character, strictness level, use "warning" or "error" to determine the minimal criteria to halt execution

skip

logical, set to TRUE to skip all tests

skip.action

character, determines what happens when skip=TRUE. Action 'log' sends an INFO message to the logger, 'none' is silent.

logging.level

character, code to indicate logging level; leave NA to use the logging level specified in suite constructor; set NULL to avoid logging altogether

log.file

character, path to log file, or leave NA to follow the logger set up within suite

x.name

character, (used by validate_batch), leave NA during standard usage

suite.name

character, (used by validate_batch), leave NA during standard usage

...

other arguments, not used

Value

object x, unchanged

vector with pass, warning, error, and stop counts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# create a test or a suite with a test
test_1 <- consonance_test("a numeric", is.numeric)
suite_1 <- consonance_suite() + test_1

# applying the test or suite on numeric data
# should execute without visible output
validate(c(1, 2, 3), test_1)
validate(c(1, 2, 3), suite_1)

# applying on non-numeric data should produce messages and stop execution
# validate(letters, test_1)
# validate(letters, suite_1)

tkonopka/consonance documentation built on Oct. 9, 2020, 2:09 p.m.