library(tidyverse)
library(gtsummary)
penguins <- palmerpenguins::penguins %>%
tidyr::drop_na()
mod1 <- lm(bill_length_mm ~ bill_depth_mm + sex, data = penguins)
mod2 <- lm(body_mass_g ~ bill_length_mm + bill_depth_mm + sex, data = penguins)
t1 <- tbl_regression(
mod1,
intercept = TRUE,
pvalue_fun = function(x) style_pvalue(x, digits = 3)
) %>%
add_glance_table(include = r.squared)
t2 <- tbl_regression(
mod2,
intercept = TRUE,
pvalue_fun = function(x) style_pvalue(x, digits = 3)
) %>%
add_glance_table(include = r.squared)
tbl_merge(
tbls = list(t1, t2),
tab_spanner = c("model 1", "model 2")
)
Can the variable bill_length_mm
move from the bottom line to the line above R squre is located?
Thank you for your help!