Walk a nested scene (Unity-style) and return one row per node with: path, name, pos_x/y/z, eul_x/y/z, and (optionally) depth (root = 0).

flatten_scenario_data(
  x,
  root_path = "root",
  as_tibble = TRUE,
  include_depth = TRUE
)

Arguments

x

A scene node, a list of nodes, or a container list.

root_path

Starting label for the path column. Default: "root".

as_tibble

Return a tibble (TRUE) or data.frame (FALSE).

include_depth

Include a depth column (root = 0). Default: TRUE.

Value

A tibble/data.frame with one row per node.

Examples

df_nested <- df %>%
 ungroup() %>%
 mutate(
   scenario_data_0_flat = map(
     scenario_data_0,
     ~ flatten_scenario_data(.x)
   )
 )
#> Error in df %>% ungroup() %>% mutate(scenario_data_0_flat = map(scenario_data_0,     ~flatten_scenario_data(.x))): could not find function "%>%"