Skip to main content
QUICK REVIEW

[Paper Review] broom: An R Package for Converting Statistical Analysis Objects Into Tidy Data Frames

David Robinson|arXiv (Cornell University)|Dec 11, 2014
Data Analysis with RComputer Science11 references55 citations
TL;DR

The broom package provides a standardized framework for converting untidy statistical model outputs in R into tidy data frames using three core generics: tidy (component-level estimates), augment (observation-level predictions), and glance (model-level statistics). This enables seamless integration with tidyverse tools like dplyr and ggplot2, significantly streamlining model analysis, comparison, and visualization across multiple models or simulations.

ABSTRACT

The concept of "tidy data" offers a powerful framework for structuring data to ease manipulation, modeling and visualization. However, most R functions, both those built-in and those found in third-party packages, produce output that is not tidy, and that is therefore difficult to reshape, recombine, and otherwise manipulate. Here I introduce the broom package, which turns the output of model objects into tidy data frames that are suited to further analysis, manipulation, and visualization with input-tidy tools. Broom defines the "tidy", "augment" and "glance" generics, which arrange a model into three levels of tidy output respectively: the component level, the observation level, and the model level. I provide examples to demonstrate how these generics work with tidy tools to allow analysis and modeling of data that is divided into subsets, to recombine results from bootstrap replicates, and to perform simulations that investigate the effect of varying input parameters.

Motivation & Objective

  • Address the widespread problem of untidy statistical model outputs in R, which hinder efficient data analysis and integration with tidyverse tools.
  • Provide a standardized, extensible interface for transforming model objects from base R and third-party packages into structured, tidy data frames.
  • Enable seamless analysis of model results across multiple models, bootstrap replicates, or simulation runs by standardizing output formats.
  • Bridge the gap between complex, non-tidy model outputs and the tidy data framework essential for modern data analysis workflows.
  • Promote interoperability by encouraging package developers to implement consistent tidy, augment, and glance methods for their own model objects.

Proposed method

  • Introduce three S3 generics—tidy, augment, and glance—to standardize the conversion of statistical model outputs into tidy data frames.
  • Apply the tidy data principles (one variable per column, one observation per row, one observational unit per table) to model components, observations, and model summaries.
  • Implement methods for common model types including linear models (lm), generalized linear models (glm), mixed-effects models (lmer), survival models (coxph), and regularization models (glmnet).
  • Use dplyr and ggplot2 pipelines to demonstrate end-to-end analysis of tidied outputs, including model comparison, simulation, and visualization.
  • Support complex workflows such as bootstrap resampling and simulation studies by enabling recombination of results from multiple models into a single tidy data frame.
  • Design the package to be extensible, allowing third-party packages to implement their own tidy, augment, and glance methods for full compatibility with the tidyverse ecosystem.

Experimental results

Research questions

  • RQ1How can statistical model outputs from diverse R packages be standardized into a consistent, tidy data format for easier analysis?
  • RQ2To what extent does converting model outputs to tidy data improve the efficiency and reproducibility of data analysis workflows?
  • RQ3Can tidied model outputs enable scalable analysis across multiple models, such as in bootstrap resampling or simulation studies?
  • RQ4How does the broom framework facilitate the integration of model results with visualization and transformation tools like ggplot2 and dplyr?
  • RQ5What are the practical benefits of using standardized model tidying in exploratory data analysis and model diagnostics?

Key findings

  • The broom package successfully converts complex, untidy model outputs—such as coefficient estimates, residuals, and model fit statistics—into structured, reusable tidy data frames.
  • Tidying model outputs enables seamless integration with dplyr and ggplot2, allowing analysts to perform group-wise operations, filtering, and visualization across multiple models in a single pipeline.
  • Simulation studies using broom demonstrated that cluster center estimation accuracy decreases with increasing residual standard deviation (σ), with systematic bias observed at σ = 4.
  • The total within-cluster sum of squares profile becomes less distinct at higher σ values, making optimal k selection more challenging, as shown through faceted ggplot2 visualizations.
  • Classification purity, measured as the proportion of correctly assigned points, decreased on average with increasing σ, as confirmed by boxplot visualizations of accuracy across replications.
  • The package enables scalable, reproducible analysis of model outputs across simulations and subgroups, significantly reducing the need for manual data wrangling and workarounds to preserve row names or combine results.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.