Skip to contents

mock_spec_formula() describes a variable computed from other generated variables by evaluating an algebraic expression (a mockFormula), rather than sampled from a distribution. Evaluation happens in a restricted environment exposing only the generated columns and a fixed allow-list of base functions; see evaluate_mock_formulas().

Usage

mock_spec_formula(
  name,
  formula,
  rtype = "double",
  missing_codes = numeric(0),
  missing_proportions = numeric(0),
  garbage_rules = list(),
  provenance = "direct",
  model_hint = "auto"
)

Arguments

name

Variable name.

formula

Character scalar. An algebraic expression over other variable names, e.g. "weight / (height^2)".

rtype

R output type for the computed column. Defaults to "double".

missing_codes, missing_proportions, garbage_rules, provenance, model_hint

As for other variable specifications; applied by post-processing.

Value

A mock_spec_variable object of type "formula".