Parse and Emit 'YAML' 1.2
Overview
Converts between 'YAML' 1.2 (https://yaml.org/spec/1.2.2/) and ordinary R objects using a bundled copy of the 'cyaml' C11 parser and emitter (https://github.com/andrewmd5/cyaml), so there is no system dependency and no runtime dependency beyond R itself. Ambiguous 'YAML' features are handled strictly and predictably: duplicate keys are refused by default, the 'YAML' 1.2 core schema is followed so that yes and no resolve as strings, and integers beyond double precision are preserved rather than silently rounded. A stream of documents and a sequence are different things, and the interface keeps them apart. Input size, nesting depth and the number of values materialised are all bounded, which makes the parser usable on untrusted input.
First release. The API is complete and the package is well tested, but it is
**not frozen**: names, defaults and return types may still change. Pin the
version if you depend on it.
Features
yaml_parse()/yaml_parse_all()parse YAML 1.2 from a string or a raw vector,yaml_emit()/yaml_emit_all()convert R objects back to YAML, andyaml_read()/yaml_read_all()/yaml_write()/yaml_write_all()do the same for files. Throughout,_allmeans a YAML *stream*: several documents separated by---, which is a different thing from a sequence.- Scalars follow the YAML 1.2 core schema, so
yesandnoare strings and dates are not coerced. Quoted scalars are always strings, and a quoted empty string never becomesNULL.
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0
- Integers beyond 2^53 are preserved as
zuyaml_bigintrather than silently rounded.big_integersselects a different policy. - Tags override schema resolution, so
!!str 12is the string"12", in every spelling a core tag has: the shorthand, the verbatim form, and a handle bound by a%TAGdirective. Application tags such as!durationare ignored by default;tags = "error"refuses them. - Mappings whose keys are sequences or mappings become
zuyaml_maprather than having their structure flattened into names. This is parse-only. - Errors are classed conditions carrying a stable
code,lineandcolumn, so callers never have to match on message text. max_size,max_depthandmax_nodesbound untrusted input. The last of these is what stops alias-expansion bombs, which are small and shallow by construction and so escape the first two.- A value emitted with
yaml_emit()parses back to the same value. Strings containing a line break, and strings with leading or trailing whitespace, are quoted so that neither is lost; a double with an integral value emits as1.0, so it does not come back as an integer; and mapping keys are treated exactly like values. Asserted over the whole yaml-test-suite and over generated input. The exceptions are listed invignette("zuyaml"). - A literal NUL byte in the input is refused with an
embedded_nulcondition and a position. The underlying library treats one as end of input, so the rest of the document -- including any later documents in the stream -- would otherwise be discarded without a word. - A UTF-8 byte order mark at the start of a stream is not part of the document.
- A float outside the range of a double converts to the nearest one:
1e309isInf,1e-324is0, and1e-323is the subnormal it names. One extreme value never changes the R type of a field.
Notes
simplifydefaults toFALSE: the shape of the result never depends on the contents of the document.- The
cyamlC library is bundled and pinned to v0.1.3. Seeinst/COPYRIGHTSfor licensing and the modifications made for R compatibility, andtools/patches/README.mdfor why each one is required.
From NEWS.md in the release
Install
Health
- OK13 OKNow
- OK6 OK2026-10-08
Documentation
The repository also keeps web-only articles.
- Help pages
- 6includes a package overview page
- Examples that run
- 100%5 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 10
- Median days to close, 50 most recently updated closed PRs
- 0
Releases over time
Issues over time
10 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/pedrobtz/zuyaml on 2026-10-18.
The R CMD check workflow runs on Linux
GitHub Pages site last deployed 2026-10-10 · The repository has a site deploy workflow
pkgdown site last built 2026-10-10
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-09-07Pull request it wrote: opened by a project memberCommits: at least 10 crediting it in the message
- Claude Opus 59 commits · Sep 2026
- Claude Opus 5.51 commit · Sep 2026
Dependencies
Installing zuyaml adds no packages beyond those that come with R.
Code & Tests
People & History
- 0.1.0Latest2026-10-07 · current release ·
4 days in CRAN's queue
Listed in CRAN's incoming queue from 2026-10-03 21:57 to 2026-10-07 14:07 UTC, in 17 readings. - RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-10-07
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Copyright
- See inst/COPYRIGHTS in the package
- Download size
- 181 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("zuyaml")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-20, which the citation names so these numbers can be found later. More on citing and the projects behind them.