tab_totaltab {tabxplor}R Documentation

Add total table to a tab

Description

Add total table to a tab

Usage

tab_totaltab(
  tabs,
  totaltab = c("table", "line", "no"),
  name = "Ensemble",
  data = NULL
)

Arguments

tabs

A tibble of class tab, made with tab_plain or tab_many.

totaltab

If there are subtables, corresponding to the levels of tab_vars, totaltab = "table" add a complete total table. totaltab = "line" add a total table of only one row with the general total. totaltab = "no" remove any existing total table.

name

The name of the total table, as a single string.

data

The original database used to calculate the tab : it is only useful for mean columns (of numeric variables), in order to calculate the variances necessary to calculate confidence intervals with tab_ci.

Value

A tibble of class tab. Rows belonging to the total table can then be detected using is_tottab.

Examples

 data <- dplyr::starwars %>%
tab_prepare(sex, hair_color, gender, rare_to_other = TRUE,
            n_min = 5, na_drop_all = sex)

data %>%
  tab_plain(sex, hair_color, gender) %>%
  tab_totaltab("line")
  

[Package tabxplor version 1.1.3 Index]