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

Not intended to be used directly.

Value

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

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 of failure: #> NULL is not character.
isCharacter(character())
#> [1] FALSE #> Cause of failure: #> character() has length 0.
isCharacter("")
#> [1] FALSE #> Cause of failure: #> "" has empty string at: 1.
isCharacter(NA_character_)
#> [1] FALSE #> Cause of failure: #> NA_character_ has NA at: 1.