prepare_run_context: Prepare a run

View source: R/artma.R

prepare_run_contextR Documentation

Prepare a run

Description

First step of the artma() pipeline: resolve the output directory, open the run's output-file capture, and produce the prepared data frame. Either loads the data through prepare_data() or, when a data frame is supplied, mirrors that pipeline's preprocess and compute phases on it.

The returned context is what the run and summarize steps consume. The capture frame it opens stays open on success: the caller owns it and must close it (the run step does so when it writes the manifest, and artma() registers an on.exit() fallback). A failure inside this function closes the frame before propagating, so an aborted preparation leaves no dangling frame.

Callable repeatedly within one runtime_setup() extent, which is what the session hub needs to re-prepare data from its menu loop.

Usage

prepare_run_context(data = NULL, methods = NULL)

Arguments

data

[data.frame, optional] Data frame to analyze. When NULL, the data is loaded from the options file.

methods

[character, optional] The methods the run will invoke, used to decide which columns the data preparation must resolve.

Value

[list] The run context: df (the prepared data frame), unwinsorized_df (a function returning the same frame prepared without winsorization, built on first call and then kept; handed to methods that register winsorize = FALSE), output_dir (the base output directory; NULL when results are not saved, and replaced by the run's own directory in execute_run()), save_results and capture (the open output-file capture frame identifier).


artma documentation built on Oct. 27, 2026, 9:06 a.m.