are_chr_ish: Check if an object can be safely coerced to character

View source: R/are_chr_ish.R

are_chr_ishR Documentation

Check if an object can be safely coerced to character

Description

are_chr_ish() is a vectorized predicate function that checks whether each element of its input can be safely coerced to a character vector.

is_chr_ish() is a scalar predicate function that checks if all elements of its input can be safely coerced to a character vector.

Usage

are_chr_ish(x, ...)

is_chr_ish(x, ...)

## Default S3 method:
are_chr_ish(x, ..., depth = 1)

Arguments

x

The object to check.

...

Arguments passed to methods.

depth

⁠(length-1 integer)⁠ Current recursion depth. Do not manually set this parameter.

Value

are_chr_ish() returns a logical vector with the same length as the input. is_chr_ish() returns a ⁠length-1 logical⁠ (TRUE or FALSE) for the entire vector.

Examples

are_chr_ish(letters)
is_chr_ish(letters)

are_chr_ish(1:10)
is_chr_ish(1:10)

are_chr_ish(list("a", 1, TRUE))
is_chr_ish(list("a", 1, TRUE))

are_chr_ish(list("a", 1, list(1, 2)))
is_chr_ish(list("a", 1, list(1, 2)))

stbl documentation built on Nov. 5, 2025, 6:02 p.m.