type-predicates

0th

Percentile

Type predicates

These type predicates aim to make type testing in R more consistent. They are wrappers around 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)
is_character(x, n = NULL)
is_logical(x, n = NULL)
is_null(x)
Arguments
x
Object to be tested.
n
Expected length of a vector.
Details

Compare 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).
  • is_function() returns TRUE only for regular functions, not special or primitive functions.

See Also

bare-type-predicates scalar-type-predicates

Aliases
  • type-predicates
  • is_list
  • is_atomic
  • is_vector
  • is_integer
  • is_double
  • is_character
  • is_logical
  • is_null
Documentation reproduced from package rlang, version 0.0.0.9000, License: GPL-3

Community examples

Looks like there are no examples yet.