formatHeader {visOmopResults}R 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 gtTable and fxTable functions.

Usage

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

Arguments

result

A summarised_result.

header

Names of the columns to make headers. Names that doesn't correspond to a column of the table result, will be used as headers at the defined position.

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
  )

[Package visOmopResults version 0.3.0 Index]