Add N to regression table
Arguments
- x
(
tbl_regression
,tbl_uvregression
)
atbl_regression
ortbl_uvregression
table- location
(
character
)
location to place Ns. Select one or more ofc('label', 'level')
. Default is'label'
.When
"label"
total Ns are placed on each variable's label row. When"level"
level counts are placed on the variable level for categorical variables, and total N on the variable's label row for continuous.- ...
These dots are for future extensions and must be empty.
Examples
# Example 1 ----------------------------------
trial |>
select(response, age, grade) |>
tbl_uvregression(
y = response,
exponentiate = TRUE,
method = glm,
method.args = list(family = binomial),
hide_n = TRUE
) |>
add_n(location = "label")
Characteristic
N
OR1
95% CI1
p-value
1 OR = Odds Ratio, CI = Confidence Interval
# Example 2 ----------------------------------
glm(response ~ age + grade, trial, family = binomial) |>
tbl_regression(exponentiate = TRUE) |>
add_n(location = "level")
Characteristic
N
OR1
95% CI1
p-value
1 OR = Odds Ratio, CI = Confidence Interval