DRDataRaft/ docs
GitHub ↗

E15 Show R Rule Diagnostics

E15The extension in your workspace1 step

Use your current course session. Preparation and course runner · R script ↓

E15 Show R Rule Diagnostics

Goal: Trace a rule to its R source location.

Prerequisites: E01; add or open the course directory as a workspace folder.

MANUAL: Open the generated R file in the workspace. Refresh, select source_rule_product and run Trial Product. Select the retained result and run Show R Rule Diagnostics. Do not modify the rule file during this sequence. Formula rules do not provide verified source locations.

training_step(
  "E15",
  {
    rule_path <- file.path(training_root, "training-rule.R")
    writeLines(
      c("training_nonnegative <- function(data) {", "  data$premium >= 0", "}"),
      rule_path
    )
    source(rule_path, local = environment(), keep.source = TRUE)
    source_rule_product <- dr_product(
      "policies.source.rule",
      bad_policies,
      contract = policy_contract
    ) |>
      dr_add_quality(list(nonnegative = training_nonnegative))
    print(rule_path)
  },
  needs = c("E01", "H06"),
  enabled = training_options$gui,
  optional = TRUE
)

Expected result: The extension can mark a rule in an unchanged saved UTF-8 workspace file. Otherwise it reports skipped locations.

Task: Does a missing marker mean the rule passed?

Show solution

No. The source may be unverifiable. The retained result determines the check status.

Search documentation

Search functions, packages and guides.