vars_in_layout {rtables} | R Documentation |
List variables required by a pre-data table layout
Description
List variables required by a pre-data table layout
Usage
vars_in_layout(lyt)
## S4 method for signature 'PreDataTableLayouts'
vars_in_layout(lyt)
## S4 method for signature 'PreDataAxisLayout'
vars_in_layout(lyt)
## S4 method for signature 'SplitVector'
vars_in_layout(lyt)
## S4 method for signature 'Split'
vars_in_layout(lyt)
## S4 method for signature 'CompoundSplit'
vars_in_layout(lyt)
## S4 method for signature 'ManualSplit'
vars_in_layout(lyt)
Arguments
lyt |
( |
Details
This will walk the layout declaration and return a vector of the names of the unique variables that are used in any of the following ways:
Variable being split on (directly or via cuts)
Element of a Multi-variable column split
Content variable
Value-label variable
Value
A character vector containing the unique variables explicitly used in the layout (see the notes below).
Note
This function will not detect dependencies implicit in analysis or summary functions which accept
x
ordf
and then rely on the existence of particular variables not being split on/analyzed.The order these variable names appear within the return vector is undefined and should not be relied upon.
Examples
lyt <- basic_table() %>%
split_cols_by("ARM") %>%
split_cols_by("SEX") %>%
summarize_row_groups(label_fstr = "Overall (N)") %>%
split_rows_by("RACE",
split_label = "Ethnicity", labels_var = "ethn_lab",
split_fun = drop_split_levels
) %>%
summarize_row_groups("RACE", label_fstr = "%s (n)") %>%
analyze("AGE", var_labels = "Age", afun = mean, format = "xx.xx")
vars_in_layout(lyt)