Allows for the generation of population based on a prescribed set of rando functions.

blueprint(...)

is_blueprint(bp)

Arguments

...

arguments used to generate the blueprint, see Examples.

bp

Object to check

Value

A function that will produce a tibble, which matches the blueprint that was provided. The generated function will take the following arguments:

  • ... - any arguments that are used within the blueprinting

  • n - the number of rows that the resulting tibble should be

  • .seed - the random seed to set before generating the data

is_blueprint() simply checks whether a function is a blueprinting function or not and returns a logical.

Examples

make_tbl <- blueprint( x = r_norm(), y = r_norm() ) make_tbl(n = 2)
#> # A tibble: 2 x 2 #> x y #> <dbl> <dbl> #> 1 -1.40 -2.44 #> 2 0.255 -0.00557
make_tbl(n = 5)
#> # A tibble: 5 x 2 #> x y #> <dbl> <dbl> #> 1 0.622 -0.283 #> 2 1.15 -0.554 #> 3 -1.82 0.629 #> 4 -0.247 2.07 #> 5 -0.244 -1.63
# Blueprints can use additional parameters: make_tbl2 <- blueprint( x = r_norm(mean = x_mu), y = r_unif(min = y_min, max = y_max) ) # Which are simply passed to the generated function make_tbl2(x_mu = 10, y_min = -10, y_max = -5)
#> # A tibble: 1 x 2 #> x y #> <dbl> <dbl> #> 1 10.5 -9.84
is_blueprint(make_tbl)
#> [1] TRUE