Learn R Programming

gtsummary (version 1.2.1)

as_gt: Convert gtsummary object to a gt_tbl object

Description

Function converts gtsummary objects to a gt_tbl objects. Function is used in the background when the results are printed or knit. A user can use this function if they wish to add customized formatting available via the gt package. Review the tbl_summary vignette or tbl_regression vignette for detailed examples in the 'Advanced Customization' section.

Usage

as_gt(x, include = NULL, exclude = NULL, omit = NULL)

Arguments

x

Object created by a function from the gtsummary package (e.g. tbl_summary or tbl_regression)

include

Character vector naming gt commands to include in printing. Default is NULL, which utilizes all commands in x$gt_calls.

exclude

Character vector naming gt commands to exclude in printing. Default is NULL.

omit

DEPRECATED. Argument is synonymous with exclude vector of named gt commands to omit. Default is NULL

Value

A gt_tbl object

Example Output

See Also

tbl_summary tbl_regression tbl_uvregression tbl_survival

Examples

Run this code
# NOT RUN {
as_gt_ex <-
  trial[c("trt", "age", "response", "grade")] %>%
  tbl_summary(by = trt) %>%
  as_gt()
# }

Run the code above in your browser using DataLab