Skip to contents

Check if an object is a vector

Usage

is_strict_vec(x, null_ok = NULL)

Arguments

x

The object to check.

null_ok

A boolean indicating whether a NULL value for x is acceptable. Default: FALSE

Value

If null_ok is TRUE, returns TRUE if x is NULL or x is a vector, otherwise returns FALSE; if null_ok is FALSE, throws an error if x is NULL and returns TRUE if x is a vector, otherwise returns FALSE.

Examples

is_strict_vec(c(10, 20, 30)) # => TRUE
#> [1] TRUE
is_strict_vec(list(10, 20, 30)) # => FALSE
#> [1] FALSE