Does the input contain a (non-empty) character vector?

isCharacter(x, nullOK = FALSE, .xname = getNameInParent(x))

Arguments

x

Object.

nullOK

logical(1). If set to TRUE, x may also be NULL.

.xname

Name of object defined in x. Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause set.

Note

Updated 2019-07-29.

Enforced parameters

  • Must have length.

  • Cannot contain NA strings.

  • Cannot contain empty ("") strings.

See also

Examples

## TRUE ==== isCharacter("a")
#> [1] TRUE
## FALSE ==== isCharacter(NULL)
#> [1] FALSE #> Cause: 'NULL' is not character.
isCharacter(character())
#> [1] FALSE #> Cause: 'character()' has length 0.
isCharacter("")
#> [1] FALSE #> Cause: '""' has empty string at: 1.
isCharacter(NA_character_)
#> [1] FALSE #> Cause: 'NA_character_' has NA at: 1.