| 1 |
--- |
| 2 |
title: "Available methods" |
| 3 |
date: "`r Sys.Date()`" |
| 4 |
output: rmarkdown::html_vignette |
| 5 |
vignette: > |
| 6 |
%\VignetteIndexEntry{Available methods} |
| 7 |
%\VignetteEngine{knitr::rmarkdown} |
| 8 |
%\VignetteEncoding{UTF-8} |
| 9 |
--- |
| 10 |
|
| 11 |
```{r} |
| 12 |
#| label: setup |
| 13 |
#| include: false |
| 14 |
knitr::opts_chunk$set( |
| 15 |
collapse = TRUE, |
| 16 |
comment = "#>" |
| 17 |
) |
| 18 |
``` |
| 19 |
|
| 20 |
The following methods are currently available in `broom`: |
| 21 |
|
| 22 |
|
| 23 |
```{R} |
| 24 |
#| echo: false |
| 25 |
#| message: false |
| 26 |
library(broom) |
| 27 |
library(dplyr) |
| 28 |
library(stringr) |
| 29 |
|
| 30 |
method_df <- function(method_name) { |
| 31 |
m <- as.vector(methods(method_name)) |
| 32 |
tibble::tibble( |
| 33 |
class = str_remove(m, str_c(method_name, "[.]")), |
| 34 |
!!method_name := "x" |
| 35 |
) |
| 36 |
} |
| 37 |
|
| 38 |
method_df("tidy") |> |
| 39 |
left_join(method_df("glance")) |> |
| 40 |
left_join(method_df("augment")) |> |
| 41 |
mutate_all(tidyr::replace_na, "") |> |
| 42 |
knitr::kable() |
| 43 |
``` |