add_format: Add the formatting variables of 'indentme', 'newrows',...

View source: R/add_format.R

add_formatR Documentation

Add the formatting variables of indentme, newrows, newpage, and roworder to the results dataframe

Description

Add the formatting variables of indentme, newrows, newpage, and roworder to the results dataframe

Usage

add_format(df, tableby = NULL, groupby = NULL, .keep = FALSE)

Arguments

df

(required) dataframe of results and must contain the anbr variable.

tableby

(optional) character vector containing table by variables.

groupby

(optional) character vector containing group by variables.

.keep

(optional) should tableby and groupby variables be kept in the final dataframe. (default = FALSE).

Value

dataframe with the formatting variables indentme, newrows, newpage, and roworder added.

Examples

df <- tibble::tibble(
  row_type =
    c(
      "TABLE_BY_HEADER", "HEADER", "BY_HEADER1", "N", "VALUE",
      "COUNTS", "UNIVAR", "NESTED", "NESTED"
    ),
  nested_level = c(NA, NA, NA, NA, NA, NA, NA, 1, 2),
  group_level = c(0, 0, 0, 0, 0, 0, 0, 0, 0),
  label = c(NA, NA, NA, NA, NA, "N", NA, NA, NA),
  by = c(NA, NA, NA, NA, NA, NA, NA, NA, NA),
  tableby = c(NA, NA, NA, NA, NA, NA, NA, NA, NA),
  anbr = c(1:9)
)
add_format(df)

tidytlg documentation built on Dec. 19, 2025, 9:07 a.m.