bp_where {rando}R Documentation

Blueprint based on a condition

Description

Runs a blueprint function where a condition is true, otherwise returns NA values

Usage

bp_where(condition, bp, ...)

Arguments

condition

Condition to check before evaluating. Results will be given where this is TRUE, and NA when this is FALSE

bp

Blueprint function to run based on the condition

...

arguments passed on to Blueprint, such as .seed

Value

a tibble

Examples

make_tbl <- blueprint(
  x = r_norm(),
  y = r_unif()
)

set_n(10)
i <- r_lgl()

bp_where(i, make_tbl)

df <- tibble::tibble(
  id = 1:10,
  cnd = r_lgl()
)
dplyr::mutate(df, bp_where(cnd, make_tbl))

[Package rando version 0.2.0 Index]