Which allows to collect multiple keys into a list. This is useful when objects "inherit" from a common type, i.e. they have some fields in common but some depend on the object type.
For example to convert this list
library(tibble)
list(
list(id = 1, name = "a", a = 1, b = TRUE),
list(id = 2, name = "b", c = 3),
list(id = 3, name = "c", a = 2, b = FALSE),
list(id = 4, name = "d", c = 5)
)
tibble(
id = 1:4,
name = letters[1:4],
attributes = list(
list(a = 1, b = TRUE),
list(c = 3),
list(a = 2, b = FALSE),
list(c = 5)
)
)
#> # A tibble: 4 × 3
#> id name attributes
#> <int> <chr> <list>
#> 1 1 a <named list [2]>
#> 2 2 b <named list [1]>
#> 3 3 c <named list [2]>
#> 4 4 d <named list [1]>
Which allows to collect multiple keys into a list. This is useful when objects "inherit" from a common type, i.e. they have some fields in common but some depend on the object type.
For example to convert this list
via this spec
into this tibble
Created on 2022-12-23 with reprex v2.0.2