tab_tot {tabxplor} | R Documentation |
Add totals to a tab
Description
Add totals to a tab
Usage
tab_tot(
tabs,
tot = c("row", "col"),
name = "Total",
totcol = "last",
data = NULL
)
Arguments
tabs |
|
tot |
|
name |
The names of the totals, as a character vector of length one or two.
Use |
totcol |
|
data |
The original database used to calculate the |
Value
A tibble
of class tab
. Total rows can then be detected using
is_totrow
, and total columns using is_totcol
.
Examples
data <- dplyr::starwars %>% tab_prepare(sex, hair_color)
data %>%
tab_plain(sex, hair_color) %>%
tab_tot("col", totcol = "each")