Convert a lower triangle matrix to a full matrix
fullPTable.RdConverts a lower triangle matrix to a full matrix.
Details
This function is useful to convert a lower triangle matrix
of p-values from a pairwise test to a full matrix.
A full matrix can be passed to multcompLetters
in the multcompView package to produce a compact
letter display.
Author
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
Examples
### Example with pairwise.wilcox.test
data(BrendonSmall)
BrendonSmall$Instructor = factor(BrendonSmall$Instructor,
levels = c('Brendon Small', 'Jason Penopolis',
'Paula Small', 'Melissa Robbins',
'Coach McGuirk'))
P = pairwise.wilcox.test(x = BrendonSmall$Score, g = BrendonSmall$Instructor)
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact p-value with ties
PT = P$p.value
PT
#> Brendon Small Jason Penopolis Paula Small
#> Jason Penopolis 0.220959330 NA NA
#> Paula Small 0.047047043 0.17211887 NA
#> Coach McGuirk 0.002422994 0.01306027 0.2209593
PT1 = fullPTable(PT)
PT1
#> Brendon Small Jason Penopolis Paula Small Coach McGuirk
#> Brendon Small 1.000000000 0.22095933 0.04704704 0.002422994
#> Jason Penopolis 0.220959330 1.00000000 0.17211887 0.013060267
#> Paula Small 0.047047043 0.17211887 1.00000000 0.220959330
#> Coach McGuirk 0.002422994 0.01306027 0.22095933 1.000000000
library(multcompView)
multcompLetters(PT1)
#> Brendon Small Jason Penopolis Paula Small Coach McGuirk
#> "a" "ab" "bc" "c"