Learn R Programming

tidytidbits (version 0.2.3)

cross_tabulate: Create cross table from a tibble

Description

A wrapper of table() for convenient use in a dplyr pipeline: Pass the factors to tabulate as symbols or expressions like you would in mutate(). useNA and dnn are passed to table().

Usage

cross_tabulate(.df, ..., useNA = c("no", "ifany", "always"), dnn = NULL)

Arguments

.df

A data frame

...

Factors to tabulate by: symbolic column names / language

useNA, dnn

passed to table()

Value

Result from a call to table()

Examples

Run this code
# NOT RUN {
library(magrittr)
if (requireNamespace("survival", quietly = TRUE))
{
   survival::bladder1 %>%
      cross_tabulate(treatment, recur) %>%
      chisq.test()
}
# }

Run the code above in your browser using DataLab