| run-mold | R Documentation |
mold() according to a blueprintThis is a developer facing function that is only used if you are creating
your own blueprint subclass. It is called from mold() and dispatches off
the S3 class of the blueprint. This gives you an opportunity to mold the
data in a way that is specific to your blueprint.
run_mold() will be called with different arguments depending on the
interface to mold() that is used:
XY interface:
run_mold(blueprint, x = x, y = y)
Formula interface:
run_mold(blueprint, data = data)
Additionally, the blueprint will have been updated to contain the
formula.
Recipe interface:
run_mold(blueprint, data = data)
Additionally, the blueprint will have been updated to contain the
recipe.
If you write a blueprint subclass for new_xy_blueprint(),
new_recipe_blueprint(), or new_formula_blueprint() then your run_mold()
method signature must match whichever interface listed above will be used.
If you write a completely new blueprint inheriting only from
new_blueprint() and write a new mold() method (because you aren't using
an xy, formula, or recipe interface), then you will have full control over
how run_mold() will be called.
run_mold(blueprint, ...)
## S3 method for class 'default_formula_blueprint'
run_mold(blueprint, ..., data, call = caller_env())
## S3 method for class 'default_recipe_blueprint'
run_mold(blueprint, ..., data, call = caller_env())
## S3 method for class 'default_xy_blueprint'
run_mold(blueprint, ..., x, y, call = caller_env())
blueprint |
A preprocessing blueprint. |
... |
Not used. Required for extensibility. |
data |
A data frame or matrix containing the outcomes and predictors. |
call |
The call used for errors and warnings. |
x |
A data frame or matrix containing the predictors. |
y |
A data frame, matrix, or vector containing the outcomes. |
run_mold() methods return the object that is then immediately returned from
mold(). See the return value section of mold() to understand what the
structure of the return value should look like.
bp <- default_xy_blueprint()
outcomes <- mtcars["mpg"]
predictors <- mtcars
predictors$mpg <- NULL
run_mold(bp, x = predictors, y = outcomes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.