add_n_summary | R Documentation |
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_nonmiss}",
col_label = "**N**",
footnote = FALSE,
last = FALSE,
...
)
## S3 method for class 'tbl_svysummary'
add_n(
x,
statistic = "{N_nonmiss}",
col_label = "**N**",
footnote = FALSE,
last = FALSE,
...
)
## S3 method for class 'tbl_likert'
add_n(
x,
statistic = "{N_nonmiss}",
col_label = "**N**",
footnote = FALSE,
last = FALSE,
...
)
x |
( |
statistic |
(
The argument uses |
col_label |
( |
footnote |
(scalar |
last |
(scalar |
... |
These dots are for future extensions and must be empty. |
A table of class c('tbl_summary', 'gtsummary')
Daniel D. Sjoberg
# Example 1 ----------------------------------
trial |>
tbl_summary(by = trt, include = c(trt, age, grade, response)) |>
add_n()
# Example 2 ----------------------------------
survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) |>
tbl_svysummary(by = Survived, percent = "row", include = c(Class, Age)) |>
add_n()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.