R: Is an Object Atomic or Recursive?

is.recursive {base} | R Documentation

## Is an Object Atomic or Recursive?

### Description

`is.atomic` returns `TRUE` if `x` does not have a list structure and `FALSE` otherwise.

`is.recursive` returns `TRUE` if `x` has a recursive (list-like) structure and `FALSE` otherwise.

### Usage

    is.atomic(x)
    is.recursive(x)

### Arguments

`x` | object to be tested.

### See Also

`is.list`, `is.language`, etc, and the `demo("is.things")`.

### Examples

    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)        #   "
    is.a.r(y ~ x)     #   "
    is.a.r(expression(x+1))# should be F-T (not in 0.62.3!)

[Package Contents]