为具有两列以上的数据框架创建本体。

问题描述 投票:0回答:1

我试图从一个有三列从而有三个不同分支的数据集创建一个树形图(使用graph或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")
           )

当我有三个层次的层次结构时,我如何去创建边缘和节点列?

谢谢!我正在尝试创建一个树状结构的数据集。

r tree ontology dendrogram ggraph
1个回答
0
投票

包裹 可折叠树 可以用于多节点的树。

collapsibleTree::collapsibleTree(df, hierarchy = c("parent", "child1"), height = 600, width = 600, collapse = FALSE)
© www.soinside.com 2019 - 2024. All rights reserved.