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, ...)

Source

Modified from here: https://stats.stackexchange.com/questions/85664/r-procedure-for-comparing-multiple-categorical-variables-similar-to-anova-fol

Arguments

x

A response vector

g

A grouping vector. If not a factor it will be converted to one.

p.adjust.method

A character string specifying the method for multiple testing adjustments. See p.adjust.methods

...

Additional arguments passed to chisq.test

Examples

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