formatHeader: Create a header for gt and flextable objects

View source: R/formatHeader.R

formatHeaderR Documentation

Create a header for gt and flextable objects

Description

Pivots a ⁠<summarised_result>⁠ object based on the column names in header, generating specific column names for subsequent header formatting in formatTable function.

Usage

formatHeader(
  result,
  header,
  delim = "\n",
  includeHeaderName = TRUE,
  includeHeaderKey = TRUE
)

Arguments

result

A ⁠<summarised_result>⁠.

header

Names of the variables to make headers.

delim

Delimiter to use to separate headers.

includeHeaderName

Whether to include the column name as header.

includeHeaderKey

Whether to include the header key (header, header_name, header_level) before each header type in the column names.

Value

A tibble with rows pivotted into columns with key names for subsequent header formatting.

Examples

result <- mockSummarisedResult()

result |>
  formatHeader(
    header = c(
      "Study cohorts", "group_level", "Study strata", "strata_name",
      "strata_level"
    ),
    includeHeaderName = FALSE
  )

visOmopResults documentation built on Sept. 24, 2024, 1:08 a.m.