assert_is_factor {assertive.types}R Documentation

Is the input a factor?

Description

Checks to see if the input is an factor.

Usage

assert_is_factor(x, severity = getOption("assertive.severity", "stop"))

assert_is_ordered(x, severity = getOption("assertive.severity", "stop"))

is_factor(x, .xname = get_name_in_parent(x))

is_ordered(x, .xname = get_name_in_parent(x))

Arguments

x

Input to check.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

.xname

Not intended to be used directly.

Value

is_factor wraps is.factor, providing more information on failure. assert_is_factor returns nothing but throws an error if is_factor returns FALSE.

See Also

is.factor.

Examples

assert_is_factor(factor(sample(letters, 10)))

[Package assertive.types version 0.0-3 Index]