tab_spread {tabxplor} | R Documentation |
Spread a tab, passing a tab variable to column
Description
Spread a tab, passing a tab variable to column
Usage
tab_spread(
tabs,
spread_vars,
names_prefix,
names_sort = FALSE,
totname = "Total"
)
Arguments
tabs |
A |
spread_vars |
<tidy-select> The tab variables
to pass to column, with a syntax of type |
names_prefix |
String added to the start of every variable name. |
names_sort |
If no |
totname |
The new name of the total rows, as a single string. |
Value
A tibble
of class tab
, with less rows and more columns.
Examples
data <- forcats::gss_cat %>% dplyr::filter(year %in% c(2000, 2014))
tabs <-
tab(data, relig, marital, c(year, race), pct = "row", totaltab = "no",
color = "diff", tot = "row", rare_to_other = TRUE)
tabs %>%
dplyr::select(year, race, relig, Married) %>%
tab_spread(race)
[Package tabxplor version 1.1.3 Index]