Function that recursively go through a list object and store in a tibble the path of each element in the list. The paths can be after that edited and accessed using parceval() for example.

get_path_list(list_obj, .map_list = NULL)

Arguments

list_obj

R list object to be evaluated

.map_list

non usable parameter. This parameter is only there to ensure recursivity. Any modification of this object returns NULL

Value

A tibble containing all the paths of each element of the list and the class of each leaf (can be a list, or R objects).

See also

Examples

{

library(dplyr)
get_path_list(
  list(
    tibble = iris,
    list = list(t1 = mtcars, t2 = tibble(iris)),
    char = "foo"))

}
#> # A tibble: 6 × 2
#>   root_name                      leaf_class             
#>   <chr>                          <chr>                  
#> 1 "list_obj"                     list                   
#> 2 "list_obj[\"tibble\"]"         data.frame             
#> 3 "list_obj[[\"list\"]]"         list                   
#> 4 "list_obj[\"char\"]"           character              
#> 5 "list_obj[[\"list\"]][\"t1\"]" data.frame             
#> 6 "list_obj[[\"list\"]][\"t2\"]" tbl_df, tbl, data.frame