assert: Assertions

Description Usage Arguments Value

Description

assert_string() asserts that an object is a length 1 character vector

assert_bool() asserts that an object is a length 1 logical that is either TRUE or FALSE

assert_scalar_int() asserts than an object is a scalar integer (or integerish)

Usage

1
2
3
4
5
assert_string(x, allow_empty = TRUE)

assert_bool(x)

assert_scalar_int(x, integerish = FALSE)

Arguments

x

The object to check

allow_empty

Boolean. Should assert_string() allow an empty string? The default is TRUE.

integerish

Boolean. Should assert_scalar_int() allow x to be integerish, rather than a strict integer?

Value

The input (or an error if assertion is failed)


jesse-smith/nbscar documentation built on Dec. 20, 2021, 11:05 p.m.