comparison: Compare means/proportions across a group

Description Usage Arguments Details Value Examples

View source: R/comparison.R

Description

Compares the means/proportions across grouping by group. Produces a p- value for each comparsion.

Usage

1

Arguments

df

a dataframe

group

the grouping variable; must be a logical vector

...

columns to compare means/proportions

Details

This function produces either a t.test or a chisq.test on each of the columns in .... If the variable is.numeric, conducts t.test. If the variable is.logical or is.factor, conducts chisq.test. Note that if you are piping into this function with a variable created by dplyr::group_by() as as your grouping function, you must first dplyr::ungroup() prior to piping into compare() (see example).

Value

a data frame

Examples

1
mtcars %>% dplyr::group_by(hp > 150) %>% dplyr::ungroup() %>% comparison(`hp > 150`, hp, am)

dylanrussellmd/nsqipBileSpill documentation built on Dec. 20, 2021, 2:17 a.m.