\HeaderA{is.recursive}{Is an Object Atomic or Recursive?}{is.recursive}
\aliasA{is.atomic}{is.recursive}{is.atomic}
\keyword{programming}{is.recursive}
\keyword{classes}{is.recursive}
\begin{Description}\relax
\code{is.atomic} returns \code{TRUE} if \code{x} is an atomic vector
(or \code{NULL}) and \code{FALSE} otherwise.

\code{is.recursive} returns \code{TRUE} if \code{x} has a recursive
(list-like) structure and \code{FALSE} otherwise.
\end{Description}
\begin{Usage}
\begin{verbatim}
is.atomic(x)
is.recursive(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] object to be tested.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
These are generic: you can write methods to handle specific classes
of objects, see \LinkA{InternalMethods}{InternalMethods}.  The description here applies
only to the default method.

\code{is.atomic} is true for the atomic vector types
(\code{"logical"}, \code{"integer"}, \code{"numeric"},
\code{"complex"}, \code{"character"} and \code{"raw"}) and \code{NULL}.

Most types of language objects are regarded as recursive: those which
are not are the atomic vector types, \code{NULL} and symbols (as given
by \code{\LinkA{as.name}{as.name}}).
\end{Details}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{is.list}{is.list}},
\code{\LinkA{is.language}{is.language}}, etc,
and the \code{demo("is.things")}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
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 ??
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 (not in 0.62.3!)
\end{ExampleCode}
\end{Examples}

