tavolo.table: Create 2 x k frequency tables

Description Usage Arguments Value Examples

Description

Helper function for creating 2 x k frequency tables.

Usage

1
2
3
## S3 method for class 'table'
tavolo(df, rev = c("neither", "rows", "columns", "both"),
  ...)

Arguments

df

a 2 x k frequency table.

rev

character string indicating whether to switch row or column order, possible options are "neither", "rows", "columns", or "both". The default is "neither".

...

further arguments passed to or from other methods.

Value

tab

2 x k frequency table

Examples

1
2
3
4
5
trial <- data.frame(disease = c(rep("yes", 3), rep("no", 3)),
                    treatment = rep(c("estrogen", "placebo", "other"), 2),
                    count = c(751, 623, 7755, 7479, 9000, 456))

xtabs(count ~ treatment + disease, data = trial) %>% tavolo(rev = "columns")

catfun documentation built on June 14, 2019, 5:04 p.m.