tavolo.table {catfun}R Documentation

Create 2 x k frequency tables

Description

Helper function for creating 2 x k frequency tables.

Usage

## 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

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")

[Package catfun version 0.1.4 Index]