Reduces the depth of a list or other object. Most non-atomic objects (matrix,
data.frame, environments, etc.) are converted to a "list" in the first level
flattening. Atomic vectors, functions, and other special objects return themselves.
Usage
flatten(x, level = -1, ...)
Arguments
x
object of any class, but primarily designed for lists and other "deep" objects
level
numeric integer describing the depth at which to flatten the object. If level < 0, the object will become as flat as possible.
...
objects passed to methods
Value
flatter object
Details
flatten maps itself to each object with the aggregate x, combining
the results. Each time it is mapped, the level is reduced by 1. When level == 0,
or an atomic vector or other special object is reached, flatten returns
the object without mapping itself.