View source: R/utils_rtables.R
append_varlabels | R Documentation |
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.
append_varlabels(lyt, df, vars, indent = 0L)
lyt |
( |
df |
( |
vars |
( |
indent |
( |
A modified layout with the new variable label(s) added to the top-left material.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.