View source: R/cat_group_tbl.R
| cat_group_tbl | R Documentation |
cat_group_tbl() summarizes nominal or categorical
variables by a grouping variable, returning frequency counts and
percentages.
cat_group_tbl(
data,
row_var,
col_var,
margins = "all",
na.rm.row_var = FALSE,
na.rm.col_var = FALSE,
pivot = "longer",
only = NULL,
ignore = NULL
)
data |
A data frame. |
row_var |
A character string of the name of a variable in |
col_var |
A character string of the name of a variable in |
margins |
A character string that determines how percentage values
are calculated; whether they sum to one across rows, columns, or the
entire table (i.e., all). Defaults to |
na.rm.row_var |
A logical value indicating whether missing values for
|
na.rm.col_var |
A logical value indicating whether missing values for
|
pivot |
A character string that determines the format of the table. By
default, |
only |
A character string or vector of character strings of the types
of summary data to return. Default is |
ignore |
An optional named vector or list that defines values to exclude
from |
A tibble showing the count and percentage of each category in row_var
by each category in col_var.
Ama Nyame-Mensah
cat_group_tbl(data = nlsy,
row_var = "gender",
col_var = "bthwht",
pivot = "wider",
only = "count")
cat_group_tbl(data = nlsy,
row_var = "birthord",
col_var = "breastfed",
pivot = "longer")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.