prop: Compute proportions, percents, or counts for a single level

Description Usage Arguments Details Note Examples

View source: R/tally.R

Description

Compute proportions, percents, or counts for a single level

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
prop(x, data = parent.frame(), useNA = "no", ..., success = NULL,
  level = NULL, long.names = TRUE, sep = ".",
  format = c("proportion", "percent", "count"), quiet = TRUE,
  pval.adjust = FALSE)

prop1(..., pval.adjust = TRUE)

count(x, ...)

perc(x, data = parent.frame(), ..., format = "percent")

Arguments

x

an R object, usually a formula

data

a data frame in which x is to be evaluated

useNA

an indication of how NA's should be handled. By default, they are ignored.

...

arguments passed through to tally()

success

the level for which counts, proportions or percents are calculated

level

Deprecated. Use sucess.

long.names

a logical indicating whether long names should be when there is a conditioning variable

sep

a character used to separate portions of long names

format

one of proportion, percent, or count, possibly abbreviated

quiet

a logical indicating whether messages regarding the success level should be supressed.

pval.adjust

a logical indicating whether the "p-value" adjustment should be applied. This adjustment adds 1 to the numerator and denominator counts.

Details

prop1 is intended for the computation of p-values from randomization distributions and differs from prop only in its default value of pval.adjust.

Note

For 0-1 data, success is set to 1 by default since that a standard coding scheme for success and failure.

Examples

1
2
3
4
5
6
7
if (require(mosaicData)) {
  prop( ~sex, data=HELPrct)
  prop( ~sex, data=HELPrct, success = "male")
  count( ~sex | substance, data=HELPrct)
  prop( ~sex | substance, data=HELPrct)
  perc( ~sex | substance, data=HELPrct)
}

ProjectMOSAIC/mosaicCore documentation built on Sept. 22, 2018, 5:27 p.m.