Wrapper around is.vector that allows the mode argument to
accept a character vector of multiple specific types. TRUE
is returned if the given object is any of the given types.
Details
See is.vector for full details and for the types that can be
checked with mode.
Examples
x <- c(a = 1, b = 2)
isVector(x) # default `mode` is "any"
#> [1] TRUE
# "any" can't be given with other types.
try(isVector(x, mode = c("numeric", "any")))
#> Error in isVector(x, mode = c("numeric", "any")) :
#> In argument ‘mode’: 'any' cannot be given with other types.
# `TRUE` is returned if *any* of the types are matched.
isVector(x, mode = c("character", "list", "logical", "numeric"))
#> [1] TRUE
isVector(x, mode = c("character", "list", "logical"))
#> [1] FALSE
