It is important to use variable label and value label to produce a proper
descriptive table. Variables with value labels will be converted to ordered
factor with same order as the value labels (to_factor). And variable
labels will be used in the output. The first row will be blank with row names
of variable label. Variable name will be used if the variable does not have
a variable label.
Usage
stat_tab(
  vars,
  group = NULL,
  data,
  total = TRUE,
  select = NULL,
  add_missing = TRUE,
  digits = 2,
  digits_pct = 1,
  rounding_fn = signif_pad,
  render_num = "Median [Min, Max]",
  logical_na_impute = FALSE
)Arguments
- group
- Name of the grouping variable. 
- data
- A - data.framefrom which the variables in- varsshould be taken.
- total
- If a "Total" column will be created (default). Specify - FALSEto omit the column.
- select
- a named vector with as many components as row-variables. Every element of `select` will be used to select the individuals to be analyzed for every row-variable. Name of the vector corresponds to the row variable, element is the selection. 
- add_missing
- If missing number and missing percentage will be reported in the summary table, default is `TRUE`. This will also produce data missingness report if set - TRUE. See- report_missingfor details.
- digits
- An integer specifying the number of significant digits to keep, default is 3. 
- digits_pct
- An integer specifying the number of digits after the decimal place for percentages, default is 0. 
- rounding_fn
- The function to use to do the rounding. Defaults is - signif_pad. To round up by digits instead of significant values, set it to- round_pad.
- render_num
- A character or vector indicating which summary will be reported, default is "Median [Min, Max]". You can change this to "Median [Q1, Q3]" then the median and IQR will be reported instead of "Median [Min, Max]". Use - options(cctu_render_num = "Median [IQR]")to set global options. See details- render_numeric- num_stat.
- logical_na_impute
- Impute missing values with - FALSE(default),- NAkeep as it is, or- TRUE. The nominator for the logical vector is the number of- TRUE. For- FALSEor- TRUE, the denominator will be all values regardless of missingness, but the non-missing number used as denominator for- NA. Set it to- FALSEif you want to summarise multiple choice variables and- NAfor Yes/No type logical variables but don't want No in the summary. You can used a named list in- xand stack multiple choice in one category.