messy_df_to_tree.Rd
Convert a potentially messy 'network data frame' to a data.tree
messy_df_to_tree(x, rootName = "base", childCol = 1, parentCol = 2)
The data.tree object
messy_df <-
data.frame(
childCol = c("A", "B", "C", "D", "E"),
parentCol = c("B", "B", "A", "", "B")
);
messy_df_to_tree(
messy_df
);
#> levelName
#> 1 base
#> 2 ¦--B
#> 3 ¦ ¦--A
#> 4 ¦ ¦ °--C
#> 5 ¦ °--E
#> 6 °--D
### Note that by default, data.tree will deform
### or not accept messy data frames
# data.tree::FromDataFrameNetwork(messy_df);