I am trying to create a tree/ontology/dendrogram (using either ggraph or igraph) from a dataset that has three columns and thus three distinct branches:
df <- data.frame(
parent = c("a", "a", "a", "b", "b", "c"),
child1 = c("ax", "ax", "ay", "bx", "by", "cx"),
child2 = c("ax1", "ax2", "ay1", "bx1", "by1", "cx1")
)
How do I go about creating edge and node columns when I have three levels to the hierarchy?
Thanks!