Skip to contents

Get named element from list

Usage

getelem(l, nm)

Arguments

l

named <list>

nm

<character> element name; can be a regex pattern

Value

named <list> element

Examples

list(x1 = NA, x2 = "AA") |> getelem("x2")
#> [1] "AA"

list(x1 = NA, x2 = "AA") |> getelem("2$")
#> [1] "AA"