Return the preset_spec last attached via set_preset(), or
NULL when no session default has been set. The cascade resolver
calls this internally; users call it for diagnostics ("what is my
session inheriting?") or to copy the active default into a
per-spec override via preset().
See also
Session-scope setter: set_preset().
Per-spec partner: preset().
Examples
# ---- Example 1: Inspect after setting a session default ----
#
# `get_preset()` returns NULL before any session default has been
# attached, then returns the `preset_spec` after `set_preset()`.
get_preset() # NULL
#> NULL
set_preset(font_size = 8, orientation = "landscape")
active <- get_preset()
is_preset_spec(active) # TRUE
#> [1] TRUE
active@font_size # 8
#> [1] 8
active@orientation # "landscape"
#> [1] "landscape"
# ---- Example 2: Copy the session default into a per-spec override ----
#
# Read the session preset, tweak one knob for a single table, and
# attach as a per-spec override without disturbing the session.
set_preset(font_size = 9, paper_size = "letter")
# Read-tweak-attach without mutating the session default.
base_knobs <- get_preset()
tabular(cdisc_saf_n) |>
preset(
font_size = base_knobs@font_size,
paper_size = base_knobs@paper_size,
orientation = "landscape"
)
arm arm_short n Placebo placebo 86 Xanomeline Low Dose drug_50 96 Xanomeline High Dose drug_100 72 Total Total 254
# Reset the session default so subsequent examples / R sessions
# are not affected.
set_preset(.reset = TRUE)