tavolo.data.frame {catfun} | R Documentation |
Create 2 x k frequency tables
Description
Helper function for creating 2 x k frequency tables.
Usage
## S3 method for class 'data.frame'
tavolo(df, x, y, weight = NULL, rev = c("neither",
"rows", "columns", "both"), ...)
Arguments
df |
a dataframe with binary variable y and categorical variable x. |
x |
categorical predictor/exposure, vector. |
y |
binary outcome, vector. |
weight |
an optional vector of count weights. |
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", 2), rep("no", 2)),
treatment = c(rep(c("estrogen", "placebo"), 2)),
count = c(751, 623, 7755, 7479))
tavolo(trial, treatment, disease, count)
[Package catfun version 0.1.4 Index]