Dear all, I've run an SNK.test on a dataset and here below my columns and the model I've used :I've run an SNK.test on a dataset and here below the code I used :
response = c (28.16, 29.36, 35.44, 37.1, 4.9, 5, 5.12, 8.8958333, 11.1, 8.5, 4.48, 3.28, 3.92, 8.24, 1.5714285, 6.02, 3.14, 2.84, 5.54, 3.24, 12.62, 7.66, 15.06, 2.2857142, 1.48, 1.94, 7.22, 1.48, 5.14, 1.66, 15.66, 2.98, 4.26, 0.2653061, 10.26, 23.02, 4.12, 0.64, 10.16, 1.36, 3.22, 5.2448979, 0.28, 0.26, 1.2653061, 0.7826086, 0.46, 0.78)
trt = c (001, 001, 001, 001, 002, 002, 002, 002, 003, 003, 003, 003, 004, 004, 004, 004, 005, 005, 005, 005, 006, 006, 006, 006, 007, 007, 007, 007, 008, 008, 008, 008, 009, 009, 009, 009, 010, 010, 010, 010, 011, 011, 011, 011, 012, 012, 012, 012
rep = c(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4)
df <- data.frame(response, trt, rep)
df$response <- as.numeric(df$response)
df$trt <- as.factor(df$trt)
df$rep <- as.factor(df$rep)
model <- aov(response ~ trt + rep, data = df)
mc_SNK <- SNK.test(model,"trt", console=TRUE, group = TRUE)
My target is to get the groups column and joinging it later to the original dataset. For that I need to associate this column "groups" from mc_SNK$groups to the "trt" levels that I need for this JOIN step. My problem is that the argument "groups" doesn't have this column and I see that the output in this table is ordered by "response " dercreasing order, and my need is to order it by "trt" number increasing order, or at least having this column "trt" in this argument :
response | groups | |
---|---|---|
1 | 32.515 | a |
9 | 9.4513265 | b |
6 | 9.4064285 | b |
3 | 6.84 | b |
8 | 6.36 | b |
2 | 5.9789583 | b |
4 | 4.9378571 | b |
10 | 4.07 | b |
5 | 3.69 | b |
7 | 3.03 | b |
11 | 2.2512245 | b |
12 | 0.8219787 | b |
Can anyone help me with any idea