diffmean: Difference in means and proportions

View source: R/diffmean.R

diffmeanR Documentation

Difference in means and proportions

Description

Wrappers around diff(mean(...)) and diff(prop(...)) that facilitate better naming of the result

Usage

diffmean(x, ..., data = parent.frame(), only.2 = TRUE)

diffprop(x, ..., data = parent.frame(), only.2 = TRUE)

Arguments

x, data, ...

as in mean() or prop()

only.2

a logical indicating whether differences should only be computed between two groups.

Examples

if (require(mosaicData)) {
diffprop( homeless ~ sex , data=HELPrct)
do(3) * diffprop( homeless ~ shuffle(sex) , data=HELPrct)
diffmean( age ~ substance, data=HELPrct, only.2=FALSE)
do(3) * diffmean(age ~ shuffle(substance), data=HELPrct, only.2=FALSE)
diffmean( age ~ sex, data=HELPrct)
do(3) * diffmean(age ~ shuffle(sex), data=HELPrct)
}

mosaic documentation built on May 29, 2024, 5:27 a.m.