is.atomic(x) is.language(x) is.recursive(x)
is.atomic returns
TRUE if the mode of
x
is
numeric,
logical,
character,
complex or
null.
For example, an object of mode
list is not atomic, while
a matrix of mode
numeric is atomic.
is.language returns
TRUE if
x is some object that is part
of the language (the value of a call to
parse or an object
that has one of the
special modes used by the S-PLUS parser such as
call,
if,
expression).
is.recursive returns
TRUE if the mode of
x indicates
that
x is a recursive object; that is,
an object that can contain other objects as elements; most commonly
list
, but also
expression,
graphics, and a number of modes
used in manipulating the language.
However,
is.recursive returns
FALSE
for objects with slots.
Use
length(getSlots(x)) to determine
if an object has slots.
is.recursive and
is.atomic are not quite complementary, but
they do not overlap.
For example, objects of mode
name are neither
recursive nor atomic, and both objects return
FALSE for an object with slots.
is.language(lsfit) # returns FALSE
is.recursive(lsfit) # returns TRUE
is.language(break) # returns TRUE
is.atomic(NULL) # returns TRUE
is.language(as.call(ls("a*"))) # returns TRUE
is.recursive(as.call(ls("a*"))) # returns TRUE