I am new to R and was wondering if there was a way to add coefficients from different regression fits into a single tidy table?
Kind Regards,
Matt
I am new to R and was wondering if there was a way to add coefficients from different regression fits into a single tidy table?
Kind Regards,
Matt
You can try something like this if you only have a few models:
library(tidyverse)
library(broom)
mtcars %>%
glimpse()
mod1 <- lm(mpg ~ hp, data = mtcars)
mod2 <- lm(mpg ~ wt, data = mtcars)
mod1_tidy <- tidy(mod1) %>% mutate(model = 1)
mod2_tidy <- tidy(mod2) %>% mutate(model = 2)
bind_rows(mod1_tidy, mod2_tidy)