cosm_reg {pubh} | R Documentation |
Cosmetics for tables of regression coefficients.
Converts tables generated by tbl_regression
to huxtable
and adds some cosmetics.
Description
Cosmetics for tables of regression coefficients.
Converts tables generated by tbl_regression
to huxtable
and adds some cosmetics.
Usage
cosm_reg(gt_tbl, pad = 3, type = 3, bold = TRUE, head_label = "**Variable**")
Arguments
gt_tbl |
A table object generated by |
pad |
Numerical, padding above and bellow rows. |
type |
Anova's type to calculate global p-values. |
bold |
Display labels in bold? |
head_label |
Character, label to be used as head for the variable's column. |
Value
A huxtable
.
Examples
require(sjlabelled, quietly = TRUE)
data(diet, package = "Epi")
diet <- diet %>%
var_labels(
chd = "Coronary Heart Disease",
fibre = "Fibre intake (g/day)"
)
model_binom <- glm(chd ~ fibre, data = diet, family = binomial)
model_binom %>%
tbl_regression(exponentiate = TRUE) %>%
cosm_reg(bold = TRUE) %>%
theme_pubh(1) %>%
add_footnote(get_r2(model_binom), font_size = 9)
data(birthwt, package = "MASS")
birthwt <- birthwt %>%
mutate(
smoke = factor(smoke, labels = c("Non-smoker", "Smoker")),
race = factor(race, labels = c("White", "African American", "Other"))
) %>%
var_labels(
bwt = "Birth weight (g)",
smoke = "Smoking status",
race = "Race"
)
model_norm <- lm(bwt ~ smoke + race, data = birthwt)
model_norm %>%
tbl_regression() %>%
cosm_reg(bold = TRUE) %>%
theme_pubh(1) %>%
add_footnote(get_r2(model_norm), font_size = 9)
[Package pubh version 1.3.2 Index]