RefFootnote: Referential Footnote

View source: R/00tabletrees.R

RefFootnoteR Documentation

Referential Footnote

Description

Referential Footnote

Usage

RefFootnote(note, index = NA_integer_, symbol = NA_character_)

Arguments

note

(character(1))
The text of the footnote, not including the symbol or index.

index

(integer(1))
The index (position in the list of footnotes); this should not typically be set by users. NA (the default) indicates automatic counting.

symbol

(character(1))
The symbol to be used instead of the index value to indicate the footnote's anchor and message. NA (the default) will use the footnote's index (after automatic counting, if applicable) as its symbol.

Details

When symbol is non-missing, all footnotes with the same symbol will share a single footer entry containing note, rather than it being entered repeatedly. symbol cannot be "NA" or contain "{" or "}".

Value

a RefFootnote object suitable for use in in_rows and ⁠fnotes_at_path<-⁠ and rcell, or NULL if note is of length zero.

Examples


afun1 <- function(x, ...) {
  in_rows(
    row1 = 5,
    row2 = c(1, 2),
    .row_footnotes = list(row1 = list(RefFootnote("row 1 rfn"))),
    .cell_footnotes = list(row2 = list(RefFootnote("row 2 cfn")))
  )
}

afun2 <- function(x, ...) {
  in_rows(
    row1 = 5,
    row2 = c(1, 2),
    .row_footnotes = list(row1 = list(RefFootnote("row 1 rfn", symbol = "+"))),
    .cell_footnotes = list(row2 = list(RefFootnote("row 2 cfn", symbol = "^")))
  )
}

lyt1 <- basic_table() |>
  split_cols_by("ARM") |>
  analyze("AGE", afun = afun1)

build_table(lyt1, DM)

lyt2 <- basic_table() |>
  split_cols_by("ARM") |>
  split_rows_by("STRATA1") |>
  analyze("AGE", afun = afun2)

build_table(lyt2, DM)


rtables documentation built on Oct. 1, 2026, 9:07 a.m.

Related to RefFootnote in rtables...