I am using tbl_summary from the gtsummary package to create publication tables summarizing long lists of categorical data from a data table. For publication purposes, tbl_summary allows assigning human readable variable labels instead of variable names using the argument
label = grade ~ "Tumor Grade"
and for multiple variables in the form of a list:
label = list(api00 ~ "API in 2000",
api99 ~ "API in 1999",
api98 ~ "API in 1998")
However, I have hundreds of variables and the variable names with the corresponding human readable lables are stored in another table altogether.
How can I create a list of the format above (ie. var_name ~ "Variable label") from a separate table with those values and pass it into tbl_summary label as argument?
In other words, I have a table of the format:
VAR_NAME VAR_LABEL
var1 First variable
var2 Second variable
... ...
var159 Hundred fifty ninth variable
Is there a way to read this table and pass the arguments to the label function of tbl_summary as a list:
label = list(VAR_NAME ~ "VAR_LABEL")
Thanks in advance.
