Skip to contents

Redo a previously undone change in a spec_history stack

Usage

history_redo(hist)

Arguments

hist

A spec_history object.

Value

A list with spec, diff, label, can_undo, and can_redo, or NULL if already at the newest snapshot.

Examples

s1 <- new_spec_ir(hierarchy = list(levels = 1L, n_obs = 100L))
h <- spec_history(s1)
history_push(h, new_spec_ir(hierarchy = list(levels = 1L, n_obs = 250L)))
history_undo(h)
#> $spec
#> 
#> ── spec_ir v1.2.0 [valid] ──
#> 
#> Title: Untitled Statistical Study
#> Design: monte_carlo_lm | Estimator: lm
#> Hierarchy: 1-level (N = 100 observations)
#> Outcome: y (gaussian, link = identity)
#> Predictors: x1 [L1, normal, beta=0.3]
#> Simulation: 200 reps | alpha = 0.05 | seed = 2026 | grid: none
#> 
#> $diff
#> 
#> ── spec_diff (1 change across 1 section) 
#> • hierarchy.n_obs: 250 -> 100
#> 
#> $label
#> [1] "Initial specification"
#> 
#> $can_undo
#> [1] FALSE
#> 
#> $can_redo
#> [1] TRUE
#> 
res <- history_redo(h)
res$spec$hierarchy$n_obs
#> [1] 250