These functions remove a level hierarchy from a list. They are similar to
`unlist()`

, only ever remove a single layer of hierarchy, and
are type-stable so you always know what the type of the output is.

flatten(.x)
flatten_lgl(.x)
flatten_int(.x)
flatten_dbl(.x)
flatten_chr(.x)
flatten_dfr(.x, .id = NULL)
flatten_dfc(.x)

## Arguments

.x |
A list of flatten. The contents of the list can be anything for
`flatten` (as a list is returned), but the contents must match the
type for the other functions. |

.id |
If not `NULL` a variable with this name will be created
giving either the name or the index of the data frame. |

## Value

`flatten()`

returns a list, `flatten_lgl()`

a logical
vector, `flatten_int()`

an integer vector, `flatten_dbl()`

a
double vector, and `flatten_chr()`

a character vector.

## Examples

#> [[1]]
#> [1] 1 3 2 4
#>
#> [[2]]
#> [1] 1 2 4 3
#>

x %>% flatten()

#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 3
#>
#> [[3]]
#> [1] 2
#>
#> [[4]]
#> [1] 4
#>
#> [[5]]
#> [1] 1
#>
#> [[6]]
#> [1] 2
#>
#> [[7]]
#> [1] 4
#>
#> [[8]]
#> [1] 3
#>

x %>% flatten_int()

#> [1] 1 3 2 4 1 2 4 3

#> [1] 1 1

#> [1] 1 1