| tab_num {tabxplor} | R Documentation | 
Means table
Description
Cross categorical variables with numeric variables, and get a table of means and standard deviations.
Usage
tab_num(
  data,
  row_var,
  col_vars,
  tab_vars,
  wt,
  diff = "tot",
  ci = NULL,
  conf_level = 0.95,
  comp = c("tab", "all"),
  color = c("auto", "diff", "diff_ci", "after_ci"),
  digits = 0,
  na = c("keep", "drop", "drop_fct", "drop_num"),
  totaltab = "line",
  totaltab_name = "Ensemble",
  tot = NULL,
  total_names = "Total",
  subtext = "",
  num = FALSE,
  df = FALSE
)
Arguments
| data | A data frame. | 
| row_var | The row variable, which will be printed with one level per line. If numeric, it will be used as a factor. | 
| col_vars | The numeric variables, which will appear in columns :
means and standard deviation are calculated for each levels of  | 
| tab_vars | <tidy-select> Tab variables : a subtable is made for each combination of levels of the selected variables. Leave empty to make a simple cross-table. All tab variables are converted to factor. | 
| wt | A weight variable, of class numeric. Leave empty for unweighted results. | 
| diff | The reference cell to calculate differences (used to print  
 | 
| ci | The type of confidence intervals to calculate, passed to  
 By default, for percentages, with  | 
| conf_level | The confidence level for the confidence intervals, as a single numeric between 0 and 1. Default to 0.95 (95%). | 
| comp | Comparison level. When  | 
| color | 
 | 
| digits | The number of digits to print, as a single integer. | 
| na | The policy to adopt for missing values in row and tab variables (factors), as a single string. 
 
 | 
| totaltab | The total table,
if there are subtables/groups (i.e. when  
 | 
| totaltab_name | The name of the total table, as a single string. | 
| tot | The totals : 
 | 
| total_names | The names of the totals, as a character vector of length one or two.
Use syntax of type  | 
| subtext | A character vector to print rows of legend under the table. | 
| num | Set to  | 
| df | Set to  | 
Value
A tibble of class tabxplor_tab. If ... (tab_vars)
are provided, a tab of class tabxplor_grouped_tab.
All non-text columns are fmt vectors of class tabxplor_fmt,
storing all the data necessary to print formats and colors. Columns with row_var
and tab_vars are of class factor : every added factor will be
considered as a tab_vars and used for grouping. To add text columns without
using them in calculations, be sure they are of class character.
Examples
data <- dplyr::storms %>% tab_prepare(category, wind, na_drop_all = wind)
tab_num(data, category, wind, tot = "row", color = "after_ci")