Description Usage Arguments Details Value
construct_table()
summarizes a given variable in a one-way table with
percentages. It is mostly a wrapper around tabyl()
that allows more flexibility in ordering the output table.
1 2 3 4 5 6 7 | construct_table(
.data,
.by,
infreq = NULL,
to_na = c("unknown", "missing", "NA", "N/A", "<NA>", "^$"),
show_missing_levels = FALSE
)
|
.data |
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr) |
.by |
The variable in |
infreq |
Should the output be ordered by frequency? The default depends on the input type; see details. |
show_missing_levels |
Should all levels be shown, even if empty? |
By default, construct_table()
will order factor inputs by their level
and all other input by frequency. If infreq = TRUE
, it will all input by
frequency; if infreq = FALSE
, it will order all input alpha-numerically.
Note that the .by
variable will be converted to a factor with levels
ordered according to the output table, regardless of input type or ordering.
A tibble holding the summary table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.