Description Usage Arguments Details Value See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | is_list(x)
is_atomic(x)
is_vector(x)
is_numeric(x)
is_integer(x)
is_double(x)
is_character(x)
is_logical(x)
is_null(x)
is_function(x)
is_complex(x)
is_raw(x)
is_name(x)
is_call(x)
is_language(x)
|
x |
object to be tested. |
Compare to base R functions:
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_numeric()
is not generic so, (e.g.) dates and date times
are TRUE
, not FALSE
.
is_function()
returns TRUE
only for regular
functions, not special or primitive functions.
TRUE
or FALSE
.
Other type.predicates: bare-type-predicates
,
scalar-type-predicates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | is_atomic(NULL)
is_vector(1:3)
is_vector(list(1:3))
is_numeric(1)
is_numeric(1:3)
is_integer(1:3)
is_double(1:3)
is_double(c(1, 2, 3))
is_atomic(as.Date("2013-01-01"))
is_numeric(as.Date("2013-01-01"))
is_numeric(as.POSIXct("2013-01-01"))
is_character(letters)
is_character(factor(letters))
is_integer(factor(letters))
is_logical(NA)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.