list_flatten {listr}R Documentation

Flatten nested lists.

Description

'list_flatten()' works recursively through an input list and puts all elements of nested list to the top level. If there are no nested lists then the input is returned unchanged.

Usage

list_flatten(in_list, max_depth = -1)

Arguments

in_list

The list to flatten

max_depth

Maximum depth to recurse into.

Details

Using 'max_depth' you can control whether to flatten all nested lists. Negative values will cause all nested lists to be flattened, positive depths will limit the depth of the recursion.

Value

A list without nested lists.

Examples

my_list <- list(a = list(1, 2, 3), b = list(4, 5, 6))
list_flatten(my_list)

[Package listr version 0.1.0 Index]