Skip to contents

Convert list of lists to tibble.

Usage

lists_to_tibble(l, do_replace_list_nulls = TRUE, do_bind_rows = TRUE)

Arguments

l

A list of lists.

do_replace_list_nulls

A logical scalar: if TRUE, first replace NULL items in each sublist by NAs.

do_bind_rows

A logical scalar: if TRUE, bind all tibbles by rows, otherwise return a list of tibbles.

Value

See the do_bind_rows argument.

Examples

lists_to_tibble(list(list(a = 1, b = 2), list(b = 3, a = 4, c = 5)))
#> # A tibble: 2 × 3
#>       a     b     c
#>   <dbl> <dbl> <dbl>
#> 1     1     2    NA
#> 2     4     3     5
lists_to_tibble(list(list(a = 1, b = 2), list(b = 3, a = 4, c = 5)), do_bind_rows = FALSE)
#> [[1]]
#> # A tibble: 1 × 2
#>       a     b
#>   <dbl> <dbl>
#> 1     1     2
#> 
#> [[2]]
#> # A tibble: 1 × 3
#>       b     a     c
#>   <dbl> <dbl> <dbl>
#> 1     3     4     5
#>