Syntax and Notation
The gtsummary package also utilizes selectors: selectors from the tidyselect package and custom selectors. Review their help files for details.
Many arguments throughout the gtsummary package accept list and
formula notation, e.g.
tbl_summary(statistic=). Below enumerates a few
tips and shortcuts for using the list and formulas.
List of Formulas
Typical usage includes a list of formulas, where the LHS is a variable name or a selector.
You may also pass a named list; however, the tidyselect and gtsummary selectors are not supported with this syntax.
Hybrid Named List/List of Formulas
Pass a combination of formulas and named elements
You can pass a single formula, which is equivalent to passing the formula in a list.
As a shortcut to select all variables, you can omit the LHS of the formula. The two calls below are equivalent.
Selectors can be combined using the