R/get_dataframe_from_nested_list.R
get_dataframe_from_nested_list.Rd
Return all values from a nested list in a dataframe
get_dataframe_from_nested_list(x, nestingIn = "children")
The nested list
The name containing the nested lists
A dataframe
nestedList <-
list(
id = "x",
value = "value for x",
children = list(
list(
id = "y",
value = "value for y"
),
list(
id = "z",
value = "value for z"
)
)
);
str(nestedList);
#> List of 3
#> $ id : chr "x"
#> $ value : chr "value for x"
#> $ children:List of 2
#> ..$ :List of 2
#> .. ..$ id : chr "y"
#> .. ..$ value: chr "value for y"
#> ..$ :List of 2
#> .. ..$ id : chr "z"
#> .. ..$ value: chr "value for z"
get_dataframe_from_nested_list(nestedList);
#> id value
#> 1 x value for x
#> 2 y value for y
#> 3 z value for z