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
frostingorlayerobject- number
An integer or
NA. If missing, andidis not provided, the return value is a list of the operations in the frosting. If a number is given, atidymethod is executed for that operation in the frosting (if it exists).numbermust not be provided ifidis.- id
A character string or
NA. If missing andnumberis not provided, the return value is a list of the operations in the frosting. If a character string is given, atidymethod is executed for that operation in the frosting (if it exists).idmust not be provided ifnumberis.- ...
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
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_A9P3F
#> 2 2 layer naomit naomit_0BHNB