I performed a Friedman's test, which showed that there are differences among my treatments. Thus, I choose to perform the Nemenyi's post-hoc test in order to infer which treatments statistically differ among them. Thus, I used the posthoc.friedman.nemenyi.test from the PMCMR package to perform pairwise comparisons between treatments.

Now, I want to divide my treatments into groups, like the example below.

Treatment 1    a
Treatment 2    ab
Treatment 3     b
Treatment 4      c

My question is: Given the p-values of a multiple-comparison post-hoc test, how can I split my treatments into groups as the above example?

Note: This question is very similar to How to obtain the results of a Tukey HSD post-hoc test in a table showing grouped pairs?. However, I want to get this information for the Nemenyi's test instead of the Tukey's test.

  • $\begingroup$ What do you mean by "How can I do that?"? Are you asking for code? (Note that questions that are only about how to use software are off topic here.) $\endgroup$ Oct 15, 2018 at 18:49
  • $\begingroup$ This is virtually the same question as pointed in my reference (that was answered here in Cross Validated). I want an algorithm (or the idea of an algorithm) to perform such a task, not the code itself. I edited the question for a clearer objective. $\endgroup$ Oct 15, 2018 at 18:52

1 Answer 1


After a little more of research, I found a R code that solved this question. However, I still don't know how it works.

It is possible to use the multcompLetters function of the multcompView package along with the fullPTable function of the rcompanion package.

Thus, the following code outputs the grouped treatments:



pTable  = posthoc.friedman.nemenyi.test(input)$p.value
pTableComplete = fullPTable(pTable)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.