Learn R Programming

rando (version 0.2.0)

blueprint: Blueprint a Dataset

Description

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

Usage

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

Run this code
# NOT RUN {
make_tbl <- blueprint(
  x = r_norm(),
  y = r_norm()
)

make_tbl(n = 2)

make_tbl(n = 5)

# 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)

is_blueprint(make_tbl)

# }

Run the code above in your browser using DataLab