gtsummary (version 1.3.6)

add_nevent.tbl_regression: Add number of events to a regression table

Description

This function adds a column of the number of events to tables created with tbl_regression. Supported model types include GLMs with binomial distribution family (e.g. stats::glm, lme4::glmer, and geepack::geeglm) and Cox Proportion Hazards regression models (survival::coxph).

The number of events is added to the internal .$table_body tibble, and not printed in the default output table (similar to N). The number of events is accessible via the inline_text function for printing in a report.

Usage

# S3 method for tbl_regression
add_nevent(x, quiet = NULL, ...)

Arguments

x

tbl_regression object

quiet

Logical indicating whether to print messages in console. Default is FALSE

...

Not used

Value

A tbl_regression object

Example Output

See Also

Other tbl_regression tools: add_global_p(), add_q(), bold_italicize_labels_levels, combine_terms(), inline_text.tbl_regression(), modify, tbl_merge(), tbl_regression(), tbl_stack()

Examples

Run this code
# NOT RUN {
add_nevent_ex <-
  glm(response ~ trt, trial, family = binomial) %>%
  tbl_regression() %>%
  add_nevent()
# }

Run the code above in your browser using DataLab