scoping_gtsummary | R Documentation |
scope_table_body()
This function uses the information in .$table_body
and adds them
as attributes to data
(if passed). Once they've been assigned as
proper gtsummary attributes, gtsummary selectors like all_continuous()
will work properly.
Columns c("var_type", "test_name", "contrasts_type")
and columns that
begin with "selector_*"
are scoped. The values of these columns are
added as attributes to a data frame. For example, if var_type='continuous'
for variable "age"
, then the attribute
attr(.$age, 'gtsummary.var_type') <- 'continuous'
is set.
That attribute is then used in a selector like all_continuous()
.
scope_header()
This function takes information from .$table_styling$header
and adds it
to table_body
. Columns that begin with 'modify_selector_'
and the hide
column.
scope_table_body(table_body, data = NULL)
scope_header(table_body, header = NULL)
table_body |
a data frame from |
data |
an optional data frame the attributes will be added to |
header |
the header data frame from |
a data frame
tbl <- tbl_summary(trial, include = c(age, grade))
scope_table_body(tbl$table_body) |> select(all_continuous()) |> names()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.