Skip to contents

Append names of a list of lists as values in each sublist.

Usage

list_names_to_values(l, key = "name")

Arguments

l

A named list of lists.

key

A character scalar: name of item under which names of outer list will be appended.

Value

A named list of lists.

Examples

list_names_to_values(list(a = list(1), b = list(c = 3)))
#> $a
#> $a[[1]]
#> [1] 1
#> 
#> $a$name
#> [1] "a"
#> 
#> 
#> $b
#> $b$c
#> [1] 3
#> 
#> $b$name
#> [1] "b"
#> 
#>