Copy List Elements into a List of Lists
Arguments
- x
list of lists
- y
list of elements
- name
name of target list element
Value
x
with each sublist being extended by list element name
having been taken from y
Examples
x <- list(list(a = 1), list(b = 2), list(c = 3))
y <- list("b1", "b2", "b3")
str(copyListElements(x, y, "b"))
#> List of 3
#> $ :List of 2
#> ..$ a: num 1
#> ..$ b: chr "b1"
#> $ :List of 1
#> ..$ b: chr "b2"
#> $ :List of 2
#> ..$ c: num 3
#> ..$ b: chr "b3"