Description Arguments Examples
A mungepiece allows one to fix the arguments to a mungebit (such as input and output columns), without yet necessarily specifying the data.frame on which the mungebit operates. In this way, the mungepiece can "pick up" what operations to perform on a to-be-trained dataset, and later what operations to perform on a to-be-predicted dataset, without yet knowing what the data itself is.
bit |
a mungebit. The mungepiece produced will be a wrapper around this mungebit that caches the arguments to subsequent calls. |
train_args |
a list. These will be passed when a mungebit is run
the first time using |
predict_args |
a list. These will be passed when a mungebit is run
subsequent times using |
1 2 3 4 5 6 7 8 9 | ## Not run:
doubler <- mungebit(column_transformation(function(x) x * 2))
cols <- c('Sepal.Length', 'Petal.Length')
mp <- mungepiece(doubler, list(cols))
iris2 <- mungeplane(iris)
mp$run(iris2)
stopifnot(iris2$data[cols] == 2 * iris[cols])
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.