cat_var_table: Create a summary table for categorical variables and their...

View source: R/cat_desc_table.R

cat_var_tableR Documentation

Create a summary table for categorical variables and their relationship with continuous DV

Description

This takes a set of categorical variables and a continuous dependent variable and produces a table that shows the distribution of data across the levels of the categorical variables, as well as the mean of the dependent variable for each level and the significance of pairwise comparisons between these means.

Usage

cat_var_table(
  df,
  dv,
  ...,
  var_names = NULL,
  level_names = NULL,
  p.adjust = p.adjust.methods,
  alpha_level = 0.05,
  filename = NULL,
  notes = list(),
  dv_name = NULL,
  bold_vars = TRUE,
  css_tags = list(),
  na.rm = TRUE,
  exclude_na = FALSE
)

Arguments

df

Dataframe containing the variables specified

dv

The continuous dependent variable to be presented alongside the levels of categorical variables

...

Categorical variables to be included

var_names

Tibble of old and new variable names, if variables are to be renamed for display. See get_rename_tribbles for required format

level_names

Tibble of old and new level names, if levels are to be renamed for display. See get_rename_tribbles for required format

p.adjust

One of p.adjust.methods, defaults to Holm

alpha_level

The level of significance for the pairwise comparisons (after p.adjust). Defaults to .05

filename

the file name to create on disk. Include '.html' extension to best preserve formatting (see gt::gtsave for details)

notes

List of notes to append to bottom of table.

dv_name

Optional. A different name to use for the dependent variable in the automatic table footnote explaining the M(SD) column. Defaults to dv variable name.

bold_vars

Should rows with variable names be bold. Defaults to TRUE

css_tags

List of css tags to be added, each named with the class that the tag should be added to.

na.rm

Should missing values be dropped in the dv when summary statistics are calculated?

exclude_na

Should cases that are NA on a categorical variable be dropped from that section?

Value

A list including a tibble of descriptive statistics ('descr'), the 'gt'-table ('tab') and the HTML code ('html') with 'css_tags' added


LukasWallrich/rNuggets documentation built on Aug. 26, 2022, 11:03 a.m.