fm_assert: Make Assertions on Data Types and Arguments

fm_assertR Documentation

Make Assertions on Data Types and Arguments

Description

fm_assert_mids() checks for a mids object fm_assert_progressor() checks for a progressor function or NULL fm_assert_bool() checks for a non-missing, scalar logical fm_assert_count() checks for a non-missing, finite, scalar integer-ish value >= 0 and converts its input to integer fm_assert_seed() checks for a finite, scalar integer-ish value, NA, or NULL, and converts non-NULL input to integer fm_assert_num() checks for a non-missing, scalar, finite numeric and converts its input to double fm_assert_vec_int() checks for non-missing, finite integer-ish values and converts its input to integer fm_assert_vec_num() checks for non-missnig, finite values and converts its input to double

Usage

fm_assert_mids(x, arg_nm = rlang::caller_arg(x))

fm_assert_progressor(x, arg_nm = rlang::caller_arg(x))

fm_assert_bool(x, arg_nm = rlang::caller_arg(x))

fm_assert_count(x, zero_ok = TRUE, arg_nm = rlang::caller_arg(x))

fm_assert_seed(x, arg_nm = rlang::caller_arg(x))

fm_assert_num(x, arg_nm = rlang::caller_arg(x))

fm_assert_vec_int(x, arg_nm = rlang::caller_arg(x))

fm_assert_vec_num(x, na_ok = FALSE, arg_nm = rlang::caller_arg(x))

Arguments

x

An object to check

arg_nm

The name of the object to check; can usually be inferred from the caller environment automatically

zero_ok

Should zero be included in the counting numbers or raise an error?

na_ok

Should NA, NaN, or Inf values be considered valid?

Value

If successful, x, invisibly; errors if unsuccessful. x may be converted to strictly match the required data type.


jesse-smith/futuremice documentation built on Nov. 24, 2023, 7:19 a.m.