taml_load {xfun} | R Documentation |
A simple YAML reader and writer
Description
TAML is a tiny subset of YAML. See https://yihui.org/litedown/#sec:yaml-syntax for its specifications.
Usage
taml_load(x, envir = parent.frame())
taml_file(path)
taml_save(x, path = NULL, indent = " ")
Arguments
x |
For |
envir |
The environment in which R expressions in YAML are evaluated. To
disable the evaluation, use |
path |
A file path to read from or write to. |
indent |
A character string to indent sub-lists by one level. |
Value
taml_load()
and taml_file()
return a list; if path = NULL
,
taml_save()
returns a character vector, otherwise the vector is written
to the file specified by the path
.
Examples
(res = taml_load("a: 1"))
taml_save(res)
(res = taml_load("a: 1\nb: \"foo\"\nc: null"))
taml_save(res)
(res = taml_load("a:\n b: false\n c: true\n d: 1.234\ne: bar"))
taml_save(res)
taml_save(res, indent = "\t")
taml_load("a: !expr paste(1:10, collapse = \", \")")
taml_load("a: [1, 3, 4, 2]")
taml_load("a: [1, \"abc\", 4, 2]")
taml_load("a: [\"foo\", \"bar\"]")
taml_load("a: [true, false, true]")
# the other form of array is not supported
taml_load("a:\n - b\n - c")
# and you must use the yaml package
if (loadable("yaml")) yaml_load("a:\n - b\n - c")
[Package xfun version 0.52 Index]