label_select {stRoke} | R Documentation |
Helper function for labels in gtsummary
Description
Function to select labels from list of label pairs (format: age~"Age"
).
Alternative is to use attributes, eg from library(Hmisc)
.
Usage
label_select(lst, vec)
Arguments
lst |
List of variables and labels (format: |
vec |
Vector of variables to be subset from the list |
Value
List of labels ordered like vec, formatted like lst
Examples
vars<-c("hypertension", "diabetes", "mrs_1")
labels_all<-list(rtreat~"Trial treatment",
civil~"Cohabitation",
diabetes~"Known diabetes",
hypertension~"Known hypertension",
mrs_1~"One month mRS",
mrs_6~"Six months mRS",
'[Intercept]'~"Intercept")
label_select(labels_all,vars)
## With gtsummary::tbl_summary()
#stRoke::talos[vars] |>
#gtsummary::tbl_summary(label = label_select(labels_all,vars))
[Package stRoke version 23.9.1 Index]