Provides a pipe-able, clean, flexible version of table().

tableX(.data, x1, x2, type = "count", na.rm = FALSE, format_number = FALSE)

Arguments

.data

the data frame containing the variables

x1

the first bare (not quoted) variable found in .data

x2

the second bare (not quoted) variable found in .data

type

the summarized output type; can be "count", "cell_perc", "row_perc", or "col_perc"

na.rm

logical; whether missing values should be removed

format_number

default is FALSE; if TRUE, then the numbers are formatted with commas (e.g., 20,000 instead of 20000)

Examples

if (FALSE) { library(furniture) library(tidyverse) data <- data.frame( x = sample(c(1,2,3,4), 100, replace=TRUE), y = sample(c(0,1), 100, replace=TRUE) ) tableX(data, x, y) data %>% tableX(x, y) data %>% tableX(x, y, na.rm = TRUE) }