Add column with N
For each variable in a tbl_summary table, the add_n function adds a column with the
total number of non-missing (or missing) observations
## S3 method for class 'tbl_summary'
add_n(
x,
statistic = "{n}",
col_label = "**N**",
footnote = FALSE,
last = FALSE,
missing = NULL,
...
)
## S3 method for class 'tbl_svysummary'
add_n(
x,
statistic = "{n}",
col_label = "**N**",
footnote = FALSE,
last = FALSE,
missing = NULL,
...
)x |
Object with class |
statistic |
String indicating the statistic to report. Default is the
number of non-missing observation for each variable,
|
col_label |
String indicating the column label. Default is |
footnote |
Logical argument indicating whether to print a footnote
clarifying the statistics presented. Default is |
last |
Logical indicator to include N column last in table.
Default is |
missing |
DEPRECATED. Logical argument indicating whether to print N
( |
... |
Not used |
A tbl_summary or tbl_svysummary object
Example 1

Daniel D. Sjoberg
Other tbl_summary tools:
add_overall(),
add_p.tbl_summary(),
add_q(),
add_stat_label(),
bold_italicize_labels_levels,
inline_text.tbl_summary(),
inline_text.tbl_survfit(),
modify,
tbl_merge(),
tbl_stack(),
tbl_summary()
Other tbl_svysummary tools:
add_overall(),
add_p.tbl_svysummary(),
add_q(),
add_stat_label(),
modify,
tbl_merge(),
tbl_stack(),
tbl_svysummary()
# Example 1 ----------------------------------
tbl_n_ex <-
trial[c("trt", "age", "grade", "response")] %>%
tbl_summary(by = trt) %>%
add_n()Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.