Combines multiple descriptive tables into a single table with customized row group headers and styling. This function accepts a list of tables and corresponding group headers, applies consistent styling, and outputs a styled gt table.

intermediate_header(
  tbls,
  group_header,
  color = "#8ECAE6",
  size = 16,
  align = "center",
  weight = "bold"
)

Arguments

tbls

A list of descriptive tables (generated by RastaRocket::desc_var or similar functions).

group_header

A character vector specifying the headers for each group of tables. Must be the same length as tbls.

color

A character string specifying the background color for the row group headers. Default is "#8ECAE6".

size

An integer specifying the font size for the row group headers. Default is 16.

align

A character string specifying text alignment for the row group headers. Options are "left", "center", or "right". Default is "center".

weight

A character string specifying the font weight for the row group headers. Options include "normal", "bold", etc. Default is "bold".

Value

A styled gt table combining the input tables with row group headers.

Examples

# Load necessary libraries
library(RastaRocket)
library(dplyr)

# Generate sample data
data <- data.frame(
  Age = c(rnorm(45, mean = 50, sd = 10), rep(NA, 5)),
  sexe = sample(c("Femme", "Homme"), 50, replace = TRUE, prob = c(0.6, 0.4)),
  quatre_modalites = sample(c("A", "B", "C", "D"), 50, replace = TRUE)
)

# Create descriptive tables
tb1 <- data %>%
  dplyr::select(Age, sexe) %>%
  RastaRocket::desc_var(table_title = "Demographics", group = FALSE)

tb2 <- data %>%
  dplyr::select(quatre_modalites) %>%
  RastaRocket::desc_var(table_title = "Modalities", group = FALSE)

# Combine and style tables
intermediate_header(
  tbls = list(tb1, tb2),
  group_header = c("Demographics", "Modalities")
)
Demographics
Characteristic N Overall
Demographics
Age n (d.m.) 45 (5)
    Mean (SD)
50.1 (10.0)
    Median (Q1 ; Q3)
51.3 (44.2 ; 56.1)
    Min ; Max
26.2 ; 70.9
sexe n (d.m.) 50 (0)
    Femme
24 (48.0%)
    Homme
26 (52.0%)
Modalities
quatre_modalites 50
    A
11 (22.0%)
    B
12 (24.0%)
    C
14 (28.0%)
    D
13 (26.0%)