为包含两列以上的数据框创建 ontology

Creating an ontology for dataframe with more than two columns

我正在尝试从具有三列并因此具有三个不同分支的数据集创建一个 tree/ontology/dendrogram(使用 ggraph 或 igraph):

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")
           )

当层次结构具有三个级别时,如何创建边缘和节点列?

谢谢!

collapsibleTree 可用于具有多个节点的树。

collapsibleTree::collapsibleTree(df, hierarchy = c("parent", "child1"), height = 600, width = 600, collapse = FALSE)