我正在融化的data.frame
中对子组进行Tukey测试。结果显示按两列分组的成对比较:CLASS和比较。我现在正在尝试使用multcompLetters
来获得一个紧凑的字母显示,但是这个功能似乎正在努力应对2个分组列的存在,我无法使其工作。有什么建议吗?
library(Rmisc)
library(reshape2)
library(dplyr)
library(broom)
library(multcompView)
melt <- melt(q, id=c("SITE"), value.name="Value", variable.name = "CLASS")
res = melt %>% group_by(CLASS) %>%
do(Model = TukeyHSD(aov(Value ~ SITE, data=.)))
d<-as.data.frame(tidy(res,Model))
# d
CLASS comparison estimate conf.low conf.high adj.p.value
1 W RPF-IDF -5.64993001 -18.1629976 6.8631376 0.61578460
2 W W1F-IDF -10.70481335 -20.9216903 -0.4879364 0.03723251
3 W WEF-IDF -2.13203903 -12.3489160 8.0848379 0.94129730
4 W W1F-RPF -5.05488334 -17.5679510 7.4581843 0.69432728
5 W WEF-RPF 3.51789097 -8.9951767 16.0309586 0.87037225
6 W WEF-W1F 8.57277432 -1.6441026 18.7896513 0.12542147
7 T RPF-IDF 1.22208275 -11.1641319 13.6082974 0.99314216
8 T W1F-IDF 12.26239263 2.1490907 22.3756946 0.01265170
9 T WEF-IDF 1.36837034 -8.7449316 11.4816723 0.98276187
10 T W1F-RPF 11.04030989 -1.3459048 23.4265246 0.09430748
11 T WEF-RPF 0.14628759 -12.2399271 12.5325023 0.99998789
12 T WEF-W1F -10.89402229 -21.0073242 -0.7807204 0.03090941
13 F RPF-IDF 0.22295726 -0.1514926 0.5974071 0.38471438
14 F W1F-IDF -0.02421005 -0.3299470 0.2815269 0.99641763
15 F WEF-IDF -0.04371681 -0.3494538 0.2620202 0.97978411
16 F W1F-RPF -0.24716731 -0.6216171 0.1272825 0.29647576
17 F WEF-RPF -0.26667407 -0.6411239 0.1077757 0.23549377
18 F WEF-W1F -0.01950676 -0.3252438 0.2862302 0.99811366
# Data:
structure(list(SITE = c("W1F", "W1F", "W1F", "W1F", "W1F", "W1F",
"W1F", "W1F", "W1F", "W1F", "WEF", "WEF", "WEF", "WEF", "WEF",
"WEF", "WEF", "WEF", "WEF", "WEF", "IDF", "IDF", "IDF", "IDF",
"IDF", "IDF", "IDF", "IDF", "IDF", "IDF", "RPF", "RPF", "RPF",
"RPF", "RPF"), W = c(50.3248335082344, 32.1503783057506, 33.078146225668,
26.6243531034585, 46.3001612352147, 39.017867992821, 50.3691477034539,
40.8967231287003, 32.8336792011662, 37.351932710029, 40.3501921908409,
51.713346196642, 52.3149154191213, 36.1191920698002, 52.8345251890241,
48.2627479883595, 53.167623564014, 52.3210532038903, 42.3709659209721,
45.220404565078, 57.748019765417, 51.0213932709679, 44.7954183956103,
67.0793645209468, 55.5469854470864, 44.385092330771, 46.5798952048957,
45.8198852429387, 27.6974478472881, 55.3218546189017, 34.4272809426672,
45.9434804417808, 56.4296406835413, 43.7876572070559, 39.1599690063483
), T = c(35.0123858739188, 50.2777364658016, 58.0998544379185,
68.6581227794661, 49.0573561929059, 50.8392988767598, 42.6878613087591,
53.2791649420957, 61.2798690090587, 53.3021205597255, 46.5495549774445,
35.3605354095504, 39.576398399117, 52.0145824694998, 37.8823694623313,
41.2463424906295, 39.7269386021168, 30.2565519241487, 46.8597611217055,
44.0805126859761, 30.8741813047282, 39.1975023883617, 47.1056477718865,
26.2644334651233, 30.279851425855, 42.897953960519, 48.894140393732,
48.0634680307273, 55.3131800922454, 30.9794852866962, 40.0464514559112,
36.4591028607809, 35.7317459820951, 46.5131719629344, 47.2948635362877
), F = c(0.303677273935923, 0.375264702946496, 0.213096066913728,
0, 0.215718617028241, 0.227978817744827, 0.249001708826384, 0.0784887376469621,
0.368000900702354, 0, 0.195050537785858, 0.341983704483877, 0.113484800904093,
0.348879190090183, 0.252927583087696, 0.130864768191014, 0, 0.18692580417626,
0, 0.266042808486324, 0.240414212596431, 0.206403192162335, 0.206481788649269,
0.728224578886221, 0, 0.172345930654518, 0.20051052274632, 0.25307493559239,
0.265872153122173, 0, 1.44680310336119, 0, 0.228089363397572,
0.308679771443896, 0.267877729197636)), class = c("tbl_df", "tbl",
"data.frame"), row.names = c(NA, -35L), .Names = c("SITE", "W",
"T", "F"))