• plug_data() specifies the data used in the analysis. This data is used for the preprocessing and fitting the model.

  • drop_data() removes the data from the tidyflow.

  • replace_data() first removes the data, then replaces the previous data with the new one. Any model that has already been fit based on this data will need to be refit.

plug_data(x, data, ...)

drop_data(x)

replace_data(x, data, ...)

Arguments

x

A tidyflow

data

A data frame or tibble.

...

Not used.

Value

x, updated with either a new or removed data frame.

Details

plug_data() is a required step to construct a minimal tidyflow. We advise that the data passed to the tidyflow has already been tested with the recipe before hand. The tidyflow is not an ideal workflow for prototyping with the recipe rather for prototyping with the model/grid/resample/split.

Examples


wf <- tidyflow()
wf <- plug_data(wf, mtcars)
wf
#> ══ Tidyflow ════════════════════════════════════════════════════════════════════
#> Data: 32 rows x 11 columns
#> Split: None
#> Recipe/Formula: None
#> Resample: None
#> Grid: None
#> Model: None

drop_data(wf)
#> ══ Tidyflow ════════════════════════════════════════════════════════════════════
#> Data: None
#> Split: None
#> Recipe/Formula: None
#> Resample: None
#> Grid: None
#> Model: None

replace_data(wf, iris)
#> ══ Tidyflow ════════════════════════════════════════════════════════════════════
#> Data: 150 rows x 5 columns
#> Split: None
#> Recipe/Formula: None
#> Resample: None
#> Grid: None
#> Model: None