我有兴趣测试一些网络可视化技术,但在尝试这些功能之前,我想使用数据帧构建一个邻接矩阵(from,to),如下所示.
Id Gender Col_Cold_1 Col_Cold_2 Col_Cold_3 Col_Hot_1 Col_Hot_2 Col_Hot_3
10 F pain sleep NA infection medication walking
14 F Bump NA muscle NA twitching flutter
17 M pain hemoloma Callus infection
18 F muscle pain twitching medication
Run Code Online (Sandbox Code Playgroud)
我的目标是创建一个邻接矩阵,如下所示
1) All values in columns with keyword Cold will contribute to the rows
2) All values in columns with keyword Hot will contribute to the columns
Run Code Online (Sandbox Code Playgroud)
例如,pain, sleep, Bump, muscle, hemaloma具有关键字Cold的列下的单元格值是,它们将形成行和单元格值,例如infection, medication, Callus, walking, twitching, flutter在具有关键字 …
我正在尝试使用下面的数据集创建条形图
df = structure(list(Affiliation = structure(c(1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L), .Label = c("BMI", "CCS",
"CS", "Epi", "Genom", "HSE",
"HSR", "HPR"), class = "factor"),
count = structure(c(4L, 21L, 14L, 20L, 11L, 13L, 19L, 15L,
5L, 22L, 17L, 24L, 9L, 12L, 18L, 16L, 1L, 10L, 7L, 23L, 2L,
3L, 8L, 6L), .Label = c("15", "26", "27", "32", "40", "41",
"42", "58", "62", "63", …Run Code Online (Sandbox Code Playgroud)