
Apply a single dynamic UI control edit to a spec_ir with validation
Source: R/ui-synthesize.R
patch_spec_from_control.RdPure helper powering UI-to-IR synchronization in mod_spec_controls_server().
Never calls eval() or parse(); all values are coerced deterministically
and checked against validate_spec_ir().
Arguments
- spec
Current valid
spec_irobject.- control_id
Character scalar ID matching a control from
spec_to_controls().- value
New input value from Shiny.
Value
A list containing spec (candidate spec_ir), changed (logical),
diff (spec_diff), and validation (spec_validation).
Examples
spec <- new_spec_ir(design_type = "multilevel_sim",
hierarchy = list(levels = 2L, n_clusters = 40L, cluster_size = 20L, icc = 0.2))
res <- patch_spec_from_control(spec, "n_clusters", 75)
res$validation$valid
#> [1] TRUE
res$diff
#>
#> ── spec_diff (1 change across 1 section)
#> • hierarchy.n_clusters: 40 -> 75