View source: R/config.R View source: R/config.R
| as_yaml | R Documentation |
Validates a configuration list against the package grammar using
cfg_validate() and serializes it to a YAML file on disk.
This helper is intended for reproducibility and interoperability,
allowing a fully specified in-memory configuration to be persisted
and reused in subsequent runs or edited manually by users.
Validates config and writes it to path as 'YAML'.
as_yaml(config, path)
as_yaml(config, path)
config |
List specification following the package grammar. |
path |
Output file path (for example |
The function performs validation before writing to disk. If validation fails, an error is raised and no file is written. The YAML output is a direct serialization of the validated configuration list and therefore preserves all fields, including nested structures.
The input path, returned invisibly, to allow use in pipelines.
The input path, invisibly.
tmp <- tempfile(fileext = ".yml")
cfg <- dcf_spec_template()
cfg$entry_yield <- 0.06
as_yaml(cfg, tmp)
stopifnot(file.exists(tmp))
cfg <- dcf_spec_template()
cfg$entry_yield <- 0.06
tmp <- tempfile(fileext = ".yml")
as_yaml(cfg, tmp)
stopifnot(file.exists(tmp))
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.