Function to run proportion test on grouped data.

grouped_proptest(data, grouping.vars, measure, ...)

Arguments

data

Dataframe (or tibble) from which variables are to be taken.

grouping.vars

Grouping variables.

measure

A variable for which proportion test needs to be carried out for each combination of levels of factors entered in grouping.vars.

...

Currently ignored.

Value

Dataframe with percentages and statistical details from a proportion test.

Examples

# for reproducibility set.seed(123) groupedstats::grouped_proptest( data = mtcars, grouping.vars = cyl, measure = am )
#> Warning: Chi-squared approximation may be incorrect
#> # A tibble: 3 x 8 #> cyl `0` `1` statistic p.value parameter method significance #> <dbl> <chr> <chr> <dbl> <dbl> <dbl> <chr> <chr> #> 1 4 27.27% 72.7… 2.27 0.132 1 Chi-squared test … ns #> 2 6 57.14% 42.8… 0.143 0.705 1 Chi-squared test … ns #> 3 8 85.71% 14.2… 7.14 0.00753 1 Chi-squared test … **