x is of an atomic type
x has a recursive
(list-like) structure and
object to be tested.
is.atomic is true for the atomic types
Most types of objects are regarded as recursive. Exceptions are the atomic
NULL, symbols (as given by
S4 objects with slots, external pointers, and—rarely visible
from R—weak references and byte code, see
It is common to call the atomic types ‘atomic vectors’, but
is.vector imposes further restrictions: an
object can be atomic but not a vector (in that sense).
These are primitive functions.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
1 2 3 4 5 6 7 8 9 10 11
require(stats) is.a.r <- function(x) c(is.atomic(x), is.recursive(x)) is.a.r(c(a = 1, b = 3)) # TRUE FALSE is.a.r(list()) # FALSE TRUE - a list is a list is.a.r(list(2)) # FALSE TRUE is.a.r(lm) # FALSE TRUE is.a.r(y ~ x) # FALSE TRUE is.a.r(expression(x+1)) # FALSE TRUE is.a.r(quote(exp)) # FALSE FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.