1
我想用networkD3::forceNetwork
來創建僱主和學院的圖表,僱主僱用僱員。如何創建網絡圖表?
現在,我有這樣的事情:
forceNetwork(Links= Links, Nodes= netDf ,
Source = 'collegeName', Target = 'organizationName', Value='count',
NodeID = 'collegeName', Group = 'organizationName')
但作爲預期的輸出不看。我想有,是:
每個大學- 一個氣泡
- 每個僱主
- 院校連接到僱主,僱主的數量的一種泡沫(
count
)映射到連接線的寬度。
學院從來沒有相互連接,並且同樣適用於僱主。
這是我使用netDf
數據集:
structure(list(collegeName = c("college1", "college1", "college2",
"college3", "college3", "college3", "college4", "college5", "college5",
"college6", "college6", "college6", "college7", "college7", "college7",
"college8", "college9", "college10", "college10", "college11"
), organizationName = c("employer2", "employer3", "employer2",
"employer1", "employer2", "employer3", "employer2", "employer2",
"employer3", "employer1", "employer2", "employer3", "employer1",
"employer2", "employer3", "employer2", "employer2", "employer2",
"employer3", "employer2"), count = c(858, 176, 461, 201, 2266,
495, 430, 1992, 290, 127, 1754, 549, 136, 2839, 686, 638, 275,
1388, 387, 188), group = c(2, 3, 2, 1, 2, 3, 2, 2, 3, 1, 2, 3,
1, 2, 3, 2, 2, 2, 3, 2)), .Names = c("collegeName", "organizationName",
"count", "group"), row.names = c(NA, -20L), class = "data.frame")
這是Links
數據集:
structure(list(collegeName = c(0, 0, 1, 2, 2, 2, 3, 4, 4, 5,
5, 5, 6, 6, 6, 7, 8, 9, 9, 10), organizationName = c(1, 2, 1,
0, 1, 2, 1, 1, 2, 0, 1, 2, 0, 1, 2, 1, 1, 1, 2, 1), count = c(858,
176, 461, 201, 2266, 495, 430, 1992, 290, 127, 1754, 549, 136,
2839, 686, 638, 275, 1388, 387, 188), group = c(2, 3, 2, 1, 2,
3, 2, 2, 3, 1, 2, 3, 1, 2, 3, 2, 2, 2, 3, 2)), .Names = c("collegeName",
"organizationName", "count", "group"), row.names = c(NA, -20L
), class = "data.frame")
此外,纔有可能映射一個4變量泡沫大小?舉例來說,我想將count
映射到與僱員有關的泡沫大小,我該怎麼做?
是否存在被集團,集羣它們例如具有在中心的所有'col'和'emp'左右'col'浮動任何簡單的方法? – Dambo