Skip to contents

Write a config object to a schema.rtemis.org JSON file that can be read back with read_config and consumed by rtemislive and the rtemis CLI. The emitted JSON carries a $schema field identifying the config family, so the reader can dispatch to the right object:

Usage

write_config(x, file, overwrite = FALSE, verbosity = 1L)

Arguments

x

A SuperConfig, DecomposeConfig, ClusterConfig, DecompositionConfig, ClusteringConfig, or PreprocessorConfig object.

file

Character: Path to output JSON file.

overwrite

Logical: If TRUE, overwrite an existing file.

verbosity

Integer: Verbosity level.

Value

x, invisibly.

Details

A config is an input: what a run is being asked to do. Fields it omits fall back to their setup_* defaults when read, so a config stays valid as those defaults improve. That is the opposite of a record, which states what one run actually did, with every value resolved – see write_record. The two are separate functions rather than one with a flag, because a caller should have to say which artifact they want.

Author

EDG

Examples

x <- setup_SuperConfig(
  dat_training_path = "~/Data/iris.csv",
  preprocessor_config = setup_Preprocessor(remove_duplicates = TRUE),
  hyperparameters = setup_LightRF(),
  outer_resampling_config = setup_Resampler(),
  question = "Can we tell iris species apart given their measurements?",
  outdir = "models/"
)
tmpfile <- file.path(tempdir(), "rtemis.json")
write_config(x, tmpfile, overwrite = TRUE)
#> 2026-08-09 13:22:54 
#> ✔ Created file: /var/folders/cr/lgjpmnv97lg6qtnjt9kph7qw0000gn/T//RtmpdcJDNA/rtemis.json
#>  [write_lines]