is.recursive {base} | R Documentation |
is.atomic
returns TRUE
if x
is an atomic vector
(or NULL
) and FALSE
otherwise.
is.recursive
returns TRUE
if x
has a recursive
(list-like) structure and FALSE
otherwise.
is.atomic(x) is.recursive(x)
x |
object to be tested. |
is.atomic
is true for the atomic vector types
("logical"
, "integer"
, "numeric"
,
"complex"
, "character"
and "raw"
) and NULL
.
Most types of objects are regarded as recursive, except for
atomic vector types, NULL
and symbols (as given by
as.name
).
These are primitive functions.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
is.list
,
is.language
, etc,
and the demo("is.things")
.
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 (nowadays)