| append_varlabels {tern} | R Documentation | 
Add variable labels to top left corner in table
Description
Helper layout-creating function to append the variable labels of a given variables vector from a given dataset in the top left corner. If a variable label is not found then the variable name itself is used instead. Multiple variable labels are concatenated with slashes.
Usage
append_varlabels(lyt, df, vars, indent = 0L)
Arguments
lyt | 
 (  | 
df | 
 (  | 
vars | 
 (  | 
indent | 
 (  | 
Value
A modified layout with the new variable label(s) added to the top-left material.
Note
This is not an optimal implementation of course, since we are using here the data set
itself during the layout creation. When we have a more mature rtables implementation then
this will also be improved or not necessary anymore.
Examples
lyt <- basic_table() %>%
  split_cols_by("ARM") %>%
  add_colcounts() %>%
  split_rows_by("SEX") %>%
  append_varlabels(DM, "SEX") %>%
  analyze("AGE", afun = mean) %>%
  append_varlabels(DM, "AGE", indent = 1)
build_table(lyt, DM)
lyt <- basic_table() %>%
  split_cols_by("ARM") %>%
  split_rows_by("SEX") %>%
  analyze("AGE", afun = mean) %>%
  append_varlabels(DM, c("SEX", "AGE"))
build_table(lyt, DM)