Skip to contents

Is the input vector(ish)?

Usage

isVectorish(x, nullOk = FALSE)

Arguments

x

Object.

nullOk

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

Value

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

Details

Intentionally returns TRUE for some other vector-like classes, including factor, and Rle.

Note

Updated 2022-12-14.

Examples

## TRUE ====
isVectorish(character())
#> [1] TRUE
isVectorish(factor())
#> [1] TRUE
isVectorish(integer())
#> [1] TRUE
isVectorish(logical())
#> [1] TRUE
isVectorish(S4Vectors::Rle())
#> [1] TRUE

## FALSE ====
isVectorish(data.frame())
#> [1] FALSE
isVectorish(matrix())
#> [1] FALSE
isVectorish(S4Vectors::DataFrame())
#> [1] FALSE