mungepiece: Mungepieces are mungebits that have had their arguments...

Description Arguments Examples

Description

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.

Arguments

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 mungebit$run or mungebit$train.

predict_args

a list. These will be passed when a mungebit is run subsequent times using mungebit$run or mungebit$predict.

Examples

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)

robertzk/mungebits documentation built on May 27, 2019, 10:35 a.m.