Skip to contents

Updates a spec_ir using a named list of clarification answers (keyed by clarification id or dotted IR path), updates defaults_rationale to record user confirmation, validates the specification, and returns the updated spec_ir alongside a semantic spec_diff.

Usage

answer_clarifications(spec, answers, clarifications = NULL, validate = TRUE)

Arguments

spec

A spec_ir or spec_translation object.

answers

Named list mapping clarification IDs (or IR paths) to chosen values.

clarifications

Optional list of clarification objects (automatically extracted if spec is a spec_translation).

validate

Logical; if TRUE (default), enforces assert_valid_spec_ir().

Value

A list with spec, diff, validation, and remaining clarifications.

Examples

res <- nl_to_spec("2-level power analysis")
updated <- answer_clarifications(res, list(n_clusters = 60, icc = 0.25))
updated$diff
#> 
#> ── spec_diff (2 changes across 1 section) 
#> • hierarchy.n_clusters: 40 -> 60
#> • hierarchy.icc: 0.15 -> 0.25