Learn R Programming

hardhat (version 1.0.0)

run_mold: Call mold$clean() and mold$process()

Description

This is a purely developer facing function, that is only used if you are creating a completely new blueprint inheriting only from new_blueprint(), and not from one of the more common: new_xy_blueprint(), new_recipe_blueprint(), new_formula_blueprint().

Usage

run_mold(blueprint, ...)

Arguments

blueprint

A preprocessing blueprint.

...

Not used. Required for extensibility.

Value

The preprocessed result, as a named list.

Details

Because mold() has different interfaces (like XY and formula), which require different arguments (x and y vs data), their corresponding blueprints also have different arguments for the blueprint$mold$clean() and blueprint$mold$process() functions. The sole job of run_mold() is simply to call these two functions with the right arguments.

The only time you need to implement a method for run_mold() is if you are creating a new_blueprint() that does not follow one of the three core blueprint types. In that special case, create a method for run_mold() with your blueprint type, and pass through whatever arguments are necessary to call your blueprint specific clean() and process() functions.

If you go this route, you will also need to create a mold() method if x is not a data frame / matrix, recipe, or formula. If x is one of those types, then run_mold() will be called for you by the existing mold() method, you just have to supply the run_mold() method for your blueprint.