Skip to contents

Most common checkmate functions, adapted to output rlang style error messages on failed assertions. The actual checking is done by checkmate::qtest(), checkmate::check_flag() and related functions.

R TypeScalarVector
logicalassert_flag(x)assert_logical(x)
characterassert_string(x)assert_character(x)
numericassert_number(x)assert_numeric(x)
integerassert_inumber(x)assert_integer(x)
doubleassert_dnumber(x)assert_double(x)
integerish¹assert_int(x)assert_integerish(x)
naturalish²assert_count(x)assert_naturalish(x)
factor³assert_factor(x)
complex³assert_complex(x)
raw³assert_raw(x)
Dateassert_day(x)assert_date(x)
  • ¹ integerish refers to functional integers (numbers that are very close to integer values), regardless of type (integer or double )

  • ² naturalish refers to functional integers restricted to the natural numbers (zero and positive numbers

  • ³ No assertion functions are provided for scalar factor, complex, or raw

  • ⁴ Not available in the checkmate package

abc
abc

Usage

qassert(x, ...)

assert_flag(x, ...)

assert_string(x, ...)

assert_number(x, ...)

assert_inumber(x, ...)

assert_dnumber(x, ...)

assert_int(x, ...)

assert_count(x, ...)

assert_day(x, ...)

assert_logical(x, ...)

assert_character(x, ...)

assert_numeric(x, ...)

assert_integer(x, ...)

assert_double(x, ...)

assert_integerish(x, ...)

assert_naturalish(x, ...)

assert_factor(x, ...)

assert_complex(x, ...)

assert_raw(x, ...)

assert_date(x, ...)

assert_scalar(x, ...)

assert_atomic(x, ...)

assert_list(x, ...)

assert_list(x, ...)

assert_class(x, ...)

assert_data_frame(x, ...)

assert_data_table(x, ...)

assert_tibble(x, ...)

Arguments

x

The variable to assert

...

Additional parameters passed to corresponding checkmate functions checkmate::qtest(), checkmate::check_flag(), etc.

Value

The original object if the assertion passes.