tidy
will return a data frame that contains information
regarding a frosting or operation within the frosting (when a tidy
method for the operation exists). Note that this is a modified
version of the tidy
method for a recipe.
Usage
# S3 method for class 'frosting'
tidy(x, number = NA, id = NA, ...)
Arguments
- x
A
frosting
orlayer
object- number
An integer or
NA
. If missing, andid
is not provided, the return value is a list of the operations in the frosting. If a number is given, atidy
method is executed for that operation in the frosting (if it exists).number
must not be provided ifid
is.- id
A character string or
NA
. If missing andnumber
is not provided, the return value is a list of the operations in the frosting. If a character string is given, atidy
method is executed for that operation in the frosting (if it exists).id
must not be provided ifnumber
is.- ...
Not currently used.
Value
A tibble with columns that vary depending on what
tidy
method is executed. When number
, and id
are NA
, a
tibble with columns number
(the operation iteration),
operation
("layer"),
type
(the method, e.g. "predict", "naomit"), and a character column id
.
Examples
library(dplyr)
jhu <- covid_case_death_rates %>%
filter(time_value > "2021-11-01", geo_value %in% c("ak", "ca", "ny"))
r <- epi_recipe(jhu) %>%
step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
step_epi_ahead(death_rate, ahead = 7) %>%
step_epi_naomit()
wf <- epi_workflow(r, parsnip::linear_reg()) %>% fit(jhu)
latest <- get_test_data(recipe = r, x = jhu)
f <- frosting() %>%
layer_predict() %>%
layer_naomit(.pred)
tidy(f)
#> # A tibble: 2 × 4
#> number operation type id
#> <int> <chr> <chr> <chr>
#> 1 1 layer predict predict_default_Yd5NX
#> 2 2 layer naomit naomit_qfEOY