Learn R Programming

clinify (version 0.3.0)

clin_group_pad: Add Padding Between Groups in a Clinical Flextable

Description

Adds top padding to rows in a `clintable`` based on changes in a grouping variable or non-empty values. Useful for visually separating groups in a table

Usage

clin_group_pad(
  x,
  pad_by,
  size = 9,
  when = c("change", "notempty"),
  drop = FALSE
)

Value

A clintable object with modified padding.

Arguments

x

A clintable

pad_by

A string indicating the column name used to detect group changes.

size

Numeric value for the base padding size (default is 9).

when

Character string indicating when to apply padding:

  • "notempty": Add padding when the value in pad_by is not empty.

  • "change": Add padding when the value in pad_by changes from the previous row.

drop

Keep or drop the padding variable used to identify padding locations

Examples

Run this code

ct <- clintable(mtcars) |>
  clin_group_pad('gear')

ct <- clintable(mtcars) |>
  clin_group_pad('gear', size = 15)

Run the code above in your browser using DataLab