sc_cols_bounded: Checks that all elements from the specified columns are in a...

Description Usage Arguments Value Examples

View source: R/convenience.R

Description

Checks that all elements from the specified columns are in a certain range

Usage

1
sc_cols_bounded(object, cols, rule = "(-Inf, Inf)", ...)

Arguments

object

table with a columns specified by cols

cols

vector of characters of columns that are checked against the specified range

rule

check as two numbers separated by a comma, enclosed by square brackets (endpoint included) or parentheses (endpoint excluded). For example, “[0, 3)” results in all(x >= 0 & x < 3). The lower and upper bound may be omitted which is the equivalent of a negative or positive infinite bound, respectively. By definition [0,] contains Inf, while [0,) does not. The same holds for the left (lower) boundary and -Inf. This explanation was copied from checkmate::qtest. That function is also the backbone of the this function.

...

further parameters that are passed to add_sanity_check.

Value

list of logical vectors where TRUE indicates where the check failed. Every list entry represents one of the columns specified in cols. This might be helpful if one wants to apply a counter-measure

Examples

1
2
3
4
5
6
dummy_call <- function(x) {
  sc_cols_bounded(object = iris, cols = c("Sepal.Length", "Petal.Length"),
    rule = "[1, 7.9)")
}
dummy_call(x = d)
get_sanity_checks()

sanityTracker documentation built on April 22, 2020, 5:09 p.m.