With declare_step, you can include any function that takes data as one of its arguments and returns data in a design declaration. The first argument is always a "handler", which is the name of the data-in, data-out function.
For handy data manipulations use declare_step(fabricate, ...)
.
Arguments
- ...
arguments to be captured, and later passed to the handler
- handler
a tidy-in, tidy-out function
- label
a string describing the step
Examples
population <- declare_model(N = 5, noise = rnorm(N))
manipulate <- declare_step(fabricate, noise_squared = noise^2, zero = 0)
design <- population + manipulate
draw_data(design)
#> ID noise noise_squared zero
#> 1 1 -0.16718535 0.0279509414 0
#> 2 2 -1.09423698 1.1973545583 0
#> 3 3 -0.25253488 0.0637738634 0
#> 4 4 0.02350475 0.0005524734 0
#> 5 5 0.93396676 0.8722939155 0