Home > Blockchain >  How to implement "broom" package in R
How to implement "broom" package in R

Time:04-18

I have an issue that might be silly in some ways, but following this question:

enter image description here

CodePudding user response:

Given your comments, you should be able to purrr::map broom::tidy over your list column of models.

fitted_models$model %>%
    purrr::map(broom::tidy)

This returns a list of your models with the coefficients, p-values etc. tidied.

You can also mutate a new column into your fitted_models data frame/tibble to keep your data frame/tibble data type. Note that we include model in the map() call because we are piping from fitted_models, not fitted_models$model:

fitted_models %>%
    mutate(tidied_models = purrr::map(model, broom::tidy)
  • Related