sanitize_table_struct: Sanitize degenerate table structures (Experimental)

View source: R/validate_table_struct.R

sanitize_table_structR Documentation

Sanitize degenerate table structures (Experimental)

Description

Experimental function to correct structure of degenerate tables by adding messaging rows to empty sub-structures.

Usage

sanitize_table_struct(tt, empty_msg = "-- This Section Contains No Data --")

Arguments

tt

TableTree

empty_msg

character(1). The string which should be spanned across the inserted empty rows.

Details

This function locates degenerate portions of the table (including the table overall in the case of a table with no data rows) and inserts a row which spans all columns with the message empty_msg at each one, generating a table guaranteed to be non-degenerate.

Value

If tt is already valid, it is returned unmodified. If tt is degenerate, a modified, non-degenerate version of the table is returned.

Examples


sanitize_table_struct(rtable("cool beans"))

lyt <- basic_table() %>%
  split_cols_by("ARM") %>%
  split_rows_by("SEX") %>%
  summarize_row_groups()

## Degenerate because it doesn't have any analyze calls -> no data rows
badtab <- build_table(lyt, DM)
sanitize_table_struct(badtab)

rtables documentation built on Aug. 30, 2023, 5:07 p.m.