This function adds information about missing and non-missing data counts to a gtsummary table. It can also apply custom statistics by group and modify the table body with an external function.

add_missing_info(
  base_table,
  show_missing_data,
  var_group = NULL,
  by_group = FALSE
)

Arguments

base_table

A gtsummary table object.

show_missing_data

Logical. If TRUE, shows the number of non-missing and missing values with percentages. If FALSE, shows only non-missing values.

var_group

Optional. A grouping variable name. If not NULL, additional stats are added by group.

by_group

A boolean (default is FALSE) to analyse by group.

Value

A gtsummary table object with missing value information and modifications applied.