diff --git a/model-many.Rmd b/model-many.Rmd index 49d0482..f3a56f7 100644 --- a/model-many.Rmd +++ b/model-many.Rmd @@ -209,18 +209,10 @@ We can use `mutate()` and `unnest()` to create a data frame with a row for each ```{r} by_country %>% mutate(glance = map(model, broom::glance)) %>% + select(-data, -model, -resids) %>% # removing the unnecessary list columns unnest(glance) ``` -This isn't quite the output we want, because it still includes all the list columns. This is default behaviour when `unnest()` works on single row data frames. To suppress these columns we use `.drop = TRUE`: - -```{r} -glance <- by_country %>% - mutate(glance = map(model, broom::glance)) %>% - unnest(glance, .drop = TRUE) -glance -``` - (Pay attention to the variables that aren't printed: there's a lot of useful stuff there.) With this data frame in hand, we can start to look for models that don't fit well: