assertions_and_primitives: A set of functions to create standardized error messages

assertions_and_primitivesR Documentation

A set of functions to create standardized error messages

Description

These are internal function for the developers of the package. The assertions are build on top of sprintf() to handle line breaks and automate insertion of arguments.

Usage

assert(expr, error_msg = "ERROR", ..., warn = FALSE)

assert_is(x, class)

assert_is_one_of(x, classes)

assert_is_single_x(x, class)

assert_inherits(x, class)

assert_valid_option(x, options)

is_one_of(x, classes)

is_column_subset(df1, df2, interger_tolerance = TRUE, factor_tolerance = TRUE)

is_single_character(x)

is_single_logical(x)

is_single_numeric(x)

has_equal_elements(x)

has_distinct_elements(x)

none(..., na.rm = FALSE)

Value

  • The assertions are called for their side effect, they raise warnings or errors

  • The primitives return TRUE or FALSE

Author(s)

Lukas Dargel

Examples


## Not run: 
assert(FALSE, "My %s error message!", "nice")

## End(Not run)


LukeCe/spflow documentation built on Nov. 11, 2023, 8:20 p.m.