Here is a more concise way actually:
library(olsrr)
library(tidyverse)
data(surgical)
surgical %>%
pivot_longer(
cols = c(-pindex, -y),
names_to = "predictor"
) %>%
group_by(predictor) %>%
group_modify(
~broom::tidy(lm(y ~ pindex + value, .x))
)
#> # A tibble: 21 x 6
#> # Groups: predictor [7]
#> predictor term estimate std.error statistic p.value
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 age (Intercept) 267. 310. 0.861 0.393
#> 2 age pindex 9.77 2.97 3.29 0.00183
#> 3 age value -3.55 4.52 -0.786 0.436
#> 4 alc_heavy (Intercept) -65.2 173. -0.377 0.707
#> 5 alc_heavy pindex 10.8 2.60 4.15 0.000125
#> 6 alc_heavy value 461. 112. 4.12 0.000138
#> 7 alc_mod (Intercept) 133. 191. 0.696 0.490
#> 8 alc_mod pindex 10.6 2.91 3.64 0.000634
#> 9 alc_mod value -187. 97.7 -1.92 0.0611
#> 10 bcs (Intercept) -328. 241. -1.36 0.180
#> # … with 11 more rows