name the elements of a list of lists by the value of the element
elementName
of each sublist
nameByElement(x, elementName = "name")
x | list of lists |
---|---|
elementName | name of element to be looked up in each sublist of
|
L <- list( list(group = "A", value = 1), list(group = "B", value = 2) ) nameByElement(L, "group")#> $A #> $A$group #> [1] "A" #> #> $A$value #> [1] 1 #> #> #> $B #> $B$group #> [1] "B" #> #> $B$value #> [1] 2 #> #>