orderFactors {EpiStats}R Documentation

Generates ordered factors.

Description

Generates ordered factors for a list of columns by name or by index or range.

Usage

 orderFactors(data, ..., values, labels=NULL)

Arguments

data

data.frame

...

character - first varname - can be unquoted

values

character - second varname - can be unquoted

labels

character - NULL (default) or ("row", "col", "both") - can be unquoted

Value

data.frame - contingency table

Author(s)

jean.pierre.decorps@gmail.com

See Also

crossTable

Examples

library(EpiStats)

# Dataset by Anja Hauri, RKI.
data(Tiramisu)
DF <- Tiramisu

# Table with percentagges and statistic on ordered factors
DF %<>%
  orderFactors(ill , values = c(1,0), labels = c("YES", "NO")) %>%
  orderFactors(sex, values = c("males", "females"), labels = c("Males", "Females"))
crossTable(DF, "ill", "sex", "both", "chi2")

[Package EpiStats version 1.6-2 Index]