Description Usage Arguments Details rows argument See Also
View source: R/modify_table_styling.R
This is a function meant for advanced users to gain
more control over the characteristics of the resulting
gtsummary table by directly modifying .$table_styling
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
x |
gtsummary object |
columns |
vector or selector of columns in |
rows |
predicate expression to select rows in |
label |
string of column label(s) |
spanning_header |
string with text for spanning header |
hide |
logical indicating whether to hide column from output |
footnote |
string with text for footnote |
footnote_abbrev |
string with abbreviation definition, e.g.
|
align |
string indicating alignment of column, must be one of
|
missing_symbol |
string indicating how missing values are formatted. |
fmt_fun |
function that formats the statistics in the
columns/rows in |
text_format |
string indicated which type of text formatting to apply to the rows and columns.
Must be one of |
undo_text_format |
rarely used. Logical that undoes the indent, bold,
and italic styling when |
text_interpret |
string, must be one of |
Review the
gtsummary definition
vignette for information on .$table_styling
objects.
The rows argument accepts a predicate expression that is used to specify
rows to apply formatting. The expression must evaluate to a logical when
evaluated in x$table_body
. For example, to apply formatting to the age rows
pass rows = variable == "age"
. A vector of row numbers is NOT acceptable.
A couple of things to note when using the rows=
argument.
You can use saved objects to create the predicate argument, e.g.
rows = variable == letters[1]
.
The saved object cannot share a name with a column in x$table_body
.
The reason for this is that in tbl_merge()
the columns are renamed,
and the renaming process cannot disambiguate the variable
column from
an external object named variable
in the following expression
rows = .data$variable = .env$variable
.
See gtsummary internals vignette
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.