A pairwhise non-parametric chi-squared test for difference between grouped categorical variables.
pairwise_chisq_test(x, g, p.adjust.method = stats::p.adjust.methods, ...)
Modified from here: https://stats.stackexchange.com/questions/85664/r-procedure-for-comparing-multiple-categorical-variables-similar-to-anova-fol
A response vector
A grouping vector. If not a factor it will be converted to one.
A character string specifying the method for multiple
testing adjustments. See p.adjust.methods
Additional arguments passed to chisq.test
group <- rep(LETTERS[1:3], 10)
sex <- rep(c('Male', 'Female'), 15)
pairwise_chisq_test(sex, group, p.adjust.method = "none")
#> ! Coercing 'g' to factor. Check output.
#>
#> Pairwise comparisons using Chi-squared test
#>
#> data: sex and group
#>
#> A B
#> B 1 -
#> C 1 1
#>
#> P value adjustment method: none