【发布时间】:2019-09-20 22:08:43
【问题描述】:
我正在尝试使用带有forceNetwork 功能的networkd3 包在r 中创建D3 网络,即
forceNetwork(Links = MisLinks, Nodes = MisNodes,
Source = "source", Target = "target",
Value = "value", NodeID = "name",
Group = "group", opacity = 0.8)
我想知道,他们根据什么来分组。
R中的样本数据给出了两个表来创建一个网络,
1) MisLink: which gives information about the links
header: |source |target |value
1 | 1 | 0 | 1
2 | 2 | 0 | 8
3 | 3 | 0 |10
4 | 3 | 2 | 6
5 | 4 | 0 | 1
2) MisNode: which consists of information regarding nodes.
header: | name| group| size
1 | Myriel | 1 | 15
2 | Napoleon | 1 | 20
3 | Mlle.Baptistine | 1 | 23
4 | Mme.Magloire | 1 | 30
5 | CountessdeLo | 1 | 11
我的节点数据没有任何组列。如何创建 GROUP 列?
我有两张表如下:
Link Table:
Source | Target | EdgeWt
5-HT1A | depression | 4
5-HT2A | depression | 5
5-HT2C | Anxiety | 3
5-HT2C | depression | 4
Node Table:
Id | NodeType
5-HT1A | GeneSymbol
5-HT2A | GeneSymbol
5-HT2C | GeneSymbol
ACNE | Disease
ACTA | GeneSymbol
ACTH | GeneSymbol
我可以将Source和Target更改为数字,但最终我想要基于NodeType的节点颜色。
【问题讨论】:
标签: r networkd3 r htmlwidgets networkd3