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.

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_character(x, n = NULL, encoding = NULL)

is_logical(x, n = NULL)

is_raw(x, n = NULL)

is_bytes(x, n = NULL)




Object to be tested.


Expected length of a vector.


Whether values must be finite. Examples of non-finite values are Inf, -Inf and NaN.


Expected encoding of a string or character vector. One of UTF-8, latin1, or unknown.


Compared to base R functions:

  • The predicates for vectors include the n argument for pattern-matching on the vector length.

  • Unlike is.atomic(), is_atomic() does not return TRUE for NULL.

  • Unlike is.vector(), is_vector() test if an object is an atomic vector or a list. is.vector checks for the presence of attributes (other than name).

See also

bare-type-predicates scalar-type-predicates