is_character: Is the input of type character?

Description Usage Arguments Value See Also Examples

View source: R/is-type-base.R

Description

Checks to see if the input is of type character.

Usage

1
2
3
4
5
6
7
assert_is_a_string(x, severity = getOption("assertive.severity", "stop"))

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

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

is_character(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_character wraps is.character, providing more information on failure. is_a_string returns TRUE if the input is character and scalar. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

See Also

is.character and is_scalar.

Examples

1
2

Example output

$`assert_is_character(factor(letters))`
<assertionError: is_character : factor(letters) is not of class 'character'; it has class 'factor'.>

assertive.types documentation built on May 1, 2019, 10:31 p.m.