These type predicates aim to make type testing in R more
consistent. They are wrappers around base::typeof(), so operate
at a level beneath S3/S4 etc.
Usage
is_list(x, n = NULL)
is_atomic(x, n = NULL)
is_vector(x, n = NULL)
is_integer(x, n = NULL)
is_double(x, n = NULL, finite = NULL)
is_complex(x, n = NULL, finite = NULL)
is_character(x, n = NULL)
is_logical(x, n = NULL)
is_raw(x, n = NULL)
is_bytes(x, n = NULL)
is_null(x)Details
Compared to base R functions:
The predicates for vectors include the
nargument for pattern-matching on the vector length.Unlike
is.atomic()in R < 4.4.0,is_atomic()does not returnTRUEforNULL. Starting in R 4.4.0is.atomic(NULL)returns FALSE.Unlike
is.vector(),is_vector()tests if an object is an atomic vector or a list.is.vectorchecks for the presence of attributes (other than name).
