I need to generate a pairwise comparison matrix from a two-way ANOVA, like the function pairwise.wilcox.test() does with its pairwise.table() function, but I dont't understand how it works.
I tried to make a 2 variable function that generates the p-value from each comparison. "consensus" is a table with all the categorical variables that I want to comparate. I want a pairwise comparison matrix as an output.
two_aov <- function (x,y){
aov <-aov(`Therapeutic Dose of Warfarin`~ y * x)
summary(aov)[[1]][3,][["Pr(>F)"]][1]
}
pairwise.table(two_aov, consensus, p.adjust.method = "none")