相关节点属性边类型
我试图找出节点属性和边类型之间的相关性。我只设法计算节点属性之间的相关矩阵,但我的预期输出将是使用
nodes %>% correlate() %>% Fashion() 的节点属性和边类型之间的相关矩阵
我可以使用此函数来关联节点属性和边类型吗?
示例数据:
nodes <- structure(list(Age = c(96L, 45L, 34L, 42L, 43L, 22L, 29L, 24L,
37L, 36L, 30L, 29L, 30L, 44L, 41L, 38L, 41L, 31L, 44L, 45L, 39L,
36L, 46L, 53L, 32L, 34L, 41L, 34L, 47L, 50L, 39L), Gender = c(2,
3, 2, 3, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 3, 3, 2, 1, 2, 3, 2, 3,
2, 1, 2, 2, 3, 2, 2, 2, 1), Main.activity = c(2, 2, 2, 1, 2,
2, 2, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2,
2, 2, 1, 2, 2), Groups = c(3, 5, 6, 5, 6, 6, 6, 6, 5, 4, 4, 5,
6, 5, 1, 6, 2, 6, 5, 6, 2, 6, 2, 4, 1, 5, 6, 2, 1, 2, 5), Religions = c(2,
3, 2, 3, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 3, 3, 2, 1, 2, 3, 2, 3,
2, 1, 2, 2, 3, 2, 2, 2, 1), Elder = c(1, 6, 2, 7, 6, 2, 2, 2,
5, 5, 6, 4, 5, 5, 6, 6, 4, 3, 2, 4, 4, 6, 2, 6, 4, 4, 6, 6, 3,
3, 4)), row.names = c("BePil01", "Be0101", "Be0102", "Be0103",
"Be0104", "Be0105", "Be0106", "Be0107", "BePil02", "Be0201",
"Be0202", "Be0203", "Be0204", "Be0205", "Be0206", "Be0207", "BePil03",
"Be0301", "Be0302", "Be0303", "Be0304", "Be0305", "Be030201",
"BePil04", "Be0401", "Be0402", "Be0403", "Be0404", "Be0405",
"Be0406", "Be0407"), class = "data.frame")
links <- structure(list(Source = c("BePil01", "BePil01", "BePil01", "BePil01",
"BePil02", "BePil02", "BePil02", "BePil02", "BePil02", "BePil02",
"BePil02", "BePil03", "BePil03", "BePil03", "BePil03", "BePil03",
"Be0302", "BePil04", "BePil04", "BePil04", "BePil04", "BePil04"
), Target = c("Be0102", "Be0104", "Be0105", "Be0106", "Be0201",
"Be0202", "Be0203", "Be0204", "Be0205", "Be0206", "Be0207", "Be0301",
"Be0302", "Be0303", "Be0304", "Be0305", "Be030201", "Be0403",
"Be0404", "Be0405", "Be0406", "Be0407"), Type = c("Directed",
"Directed", "Directed", "Directed", "Directed", "Directed", "Directed",
"Directed", "Directed", "Directed", "Directed", "Directed", "Directed",
"Directed", "Directed", "Directed", "Directed", "Directed", "Directed",
"Directed", "Directed", "Directed"), Weight = c(1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), Learning.type = c(4, 2, 4, 1, 4, 4, 2, 2, 1, 2, 4, 4,
4, 4, 2, 4, 3, 2, 5, 2, 4, 2)), row.names = c(NA, -22L), class = "data.frame")
I'm trying to find out correlation between node attributes and edge type. I only manage to compute a correlation matrix between node attributes, but my expected output would be a correlation matrix between node attributes and edge type using
nodes %>% correlate() %>% fashion()
Can I use this function for correlating node attributes and edge type?
Example data:
nodes <- structure(list(Age = c(96L, 45L, 34L, 42L, 43L, 22L, 29L, 24L,
37L, 36L, 30L, 29L, 30L, 44L, 41L, 38L, 41L, 31L, 44L, 45L, 39L,
36L, 46L, 53L, 32L, 34L, 41L, 34L, 47L, 50L, 39L), Gender = c(2,
3, 2, 3, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 3, 3, 2, 1, 2, 3, 2, 3,
2, 1, 2, 2, 3, 2, 2, 2, 1), Main.activity = c(2, 2, 2, 1, 2,
2, 2, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2,
2, 2, 1, 2, 2), Groups = c(3, 5, 6, 5, 6, 6, 6, 6, 5, 4, 4, 5,
6, 5, 1, 6, 2, 6, 5, 6, 2, 6, 2, 4, 1, 5, 6, 2, 1, 2, 5), Religions = c(2,
3, 2, 3, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 3, 3, 2, 1, 2, 3, 2, 3,
2, 1, 2, 2, 3, 2, 2, 2, 1), Elder = c(1, 6, 2, 7, 6, 2, 2, 2,
5, 5, 6, 4, 5, 5, 6, 6, 4, 3, 2, 4, 4, 6, 2, 6, 4, 4, 6, 6, 3,
3, 4)), row.names = c("BePil01", "Be0101", "Be0102", "Be0103",
"Be0104", "Be0105", "Be0106", "Be0107", "BePil02", "Be0201",
"Be0202", "Be0203", "Be0204", "Be0205", "Be0206", "Be0207", "BePil03",
"Be0301", "Be0302", "Be0303", "Be0304", "Be0305", "Be030201",
"BePil04", "Be0401", "Be0402", "Be0403", "Be0404", "Be0405",
"Be0406", "Be0407"), class = "data.frame")
links <- structure(list(Source = c("BePil01", "BePil01", "BePil01", "BePil01",
"BePil02", "BePil02", "BePil02", "BePil02", "BePil02", "BePil02",
"BePil02", "BePil03", "BePil03", "BePil03", "BePil03", "BePil03",
"Be0302", "BePil04", "BePil04", "BePil04", "BePil04", "BePil04"
), Target = c("Be0102", "Be0104", "Be0105", "Be0106", "Be0201",
"Be0202", "Be0203", "Be0204", "Be0205", "Be0206", "Be0207", "Be0301",
"Be0302", "Be0303", "Be0304", "Be0305", "Be030201", "Be0403",
"Be0404", "Be0405", "Be0406", "Be0407"), Type = c("Directed",
"Directed", "Directed", "Directed", "Directed", "Directed", "Directed",
"Directed", "Directed", "Directed", "Directed", "Directed", "Directed",
"Directed", "Directed", "Directed", "Directed", "Directed", "Directed",
"Directed", "Directed", "Directed"), Weight = c(1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), Learning.type = c(4, 2, 4, 1, 4, 4, 2, 2, 1, 2, 4, 4,
4, 4, 2, 4, 3, 2, 5, 2, 4, 2)), row.names = c(NA, -22L), class = "data.frame")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论