-
Notifications
You must be signed in to change notification settings - Fork 304
/
README.Rmd
93 lines (62 loc) · 4.41 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE,
warning = FALSE,
out.width = "100%"
)
```
# broom <img src="man/figures/logo.png" align="right" width="100" />
<!-- badges: start -->
[![R build status](https://github.com/tidymodels/broom/workflows/R-CMD-check/badge.svg)](https://github.com/tidymodels/broom)
[![CRAN status](https://www.r-pkg.org/badges/version/broom)](https://CRAN.R-project.org/package=broom)
[![Downloads](https://cranlogs.r-pkg.org/badges/broom)](https://CRAN.R-project.org/package=broom)
[![R-CMD-check](https://github.com/tidymodels/broom/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidymodels/broom/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
## Overview
`broom` summarizes key information about models in tidy `tibble()`s. `broom` provides three verbs to make it convenient to interact with model objects:
- `tidy()` summarizes information about model components
- `glance()` reports information about the entire model
- `augment()` adds informations about observations to a dataset
For a detailed introduction, please see `vignette("broom")`.
`broom` tidies 100+ models from popular modelling packages and almost all of the model objects in the `stats` package that comes with base R. `vignette("available-methods")` lists method availability.
If you aren't familiar with tidy data structures and want to know how they can make your life easier, we highly recommend reading Hadley Wickham's [Tidy Data](https://www.jstatsoft.org/v59/i10).
## Installation
```{r, eval = FALSE}
# we recommend installing the entire tidyverse
# modeling set, which includes broom:
install.packages("tidymodels")
# alternatively, to install just broom:
install.packages("broom")
# to get the development version from GitHub:
install.packages("pak")
pak::pak("tidymodels/broom")
```
If you find a bug, please file a minimal reproducible example in the [issues](https://github.com/tidymodels/broom/issues).
## Usage
`tidy()` produces a `tibble()` where each row contains information about an important component of the model. For regression models, this often corresponds to regression coefficients. This is can be useful if you want to inspect a model or create custom visualizations.
```{r}
library(broom)
fit <- lm(Volume ~ Girth + Height, trees)
tidy(fit)
```
`glance()` returns a tibble with exactly one row of goodness of fitness measures and related statistics. This is useful to check for model misspecification and to compare many models.
```{r}
glance(fit)
```
`augment` adds columns to a dataset, containing information such as fitted values, residuals or cluster assignments. All columns added to a dataset have `.` prefix to prevent existing columns from being overwritten.
```{r}
augment(fit, data = trees)
```
### Contributing
We welcome contributions of all types!
For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on Posit Community](https://forum.posit.co/new-topic?category_id=15https://rstd.io/tidymodels-communitytags=tidymodels,question). If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/broom/issues). Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example), to clearly communicate about your code. Check out further details on [contributing guidelines for tidymodels packages](https://www.tidymodels.org/contribute/) and [how to get help](https://www.tidymodels.org/help/).
If you have never directly contributed to an R package before, `broom` is an excellent place to start. Find an [issue](https://github.com/tidymodels/broom/issues/) with the **Beginner Friendly** tag and comment that you'd like to take it on and we'll help you get started.
Generally, too, we encourage typo corrections, bug reports, bug fixes and feature requests. Feedback on the clarity of the documentation is especially valuable!
If you are interested in adding tidier methods for new model objects, please read [this article](https://www.tidymodels.org/learn/develop/broom/) on the tidymodels website.
We have a [Contributor Code of Conduct](https://github.com/tidymodels/broom/blob/main/.github/CODE_OF_CONDUCT.md). By participating in `broom` you agree to abide by its terms.