Skip to contents

Get the first item in each sublist of sublists (ugh ... I know).

Usage

get_firsts(l, key)

Arguments

l

A list of lists of lists

key

Name of focal sublist (TODO: needs better description/motivation)

Examples

l = list(
  a = list(
    A = list(
      i = 1,
      ii = 2
    ),
    B = list(
      i = 3,
      ii = 4
    )
 ),
 b = list(
    A = list(
      i = 5,
      ii = 6
    ),
    B = list(
      i = 7,
      ii = 8
    )
  )
)
get_firsts(l, "A")
#> $a
#> [1] 1
#> 
#> $b
#> [1] 5
#> 
get_firsts(l, "B")
#> $a
#> [1] 3
#> 
#> $b
#> [1] 7
#>