Learn R Programming

yaml

yaml provides R bindings to libyaml, a fast YAML parser and emitter.

Installation

Install from CRAN:

install.packages("yaml")

Or install the development version from GitHub:

# install.packages("pak")
pak::pak("r-lib/r-yaml")

Usage

library(yaml)

Parse YAML with yaml.load() or read_yaml():

yaml.load(
  "
- 1
- 2
- 3
"
)
#> [1] 1 2 3

yaml.load(
  "
a: 1
b: 2
"
)
#> $a
#> [1] 1
#> 
#> $b
#> [1] 2

Convert R objects to YAML with as.yaml() or write_yaml():

cat(as.yaml(list(a = 1:3, b = 4:6)))
#> a:
#> - 1
#> - 2
#> - 3
#> b:
#> - 4
#> - 5
#> - 6

See vignette("yaml") for more details on handlers, formatting options, and advanced usage.

Copy Link

Version

Install

install.packages('yaml')

Monthly Downloads

1,136,260

Version

2.3.12

License

BSD_3_clause + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Hadley Wickham

Last Published

December 10th, 2025

Functions in yaml (2.3.12)

yaml-package

yaml: Methods to Convert R Data to YAML and Back
write_yaml

Write a YAML file
verbatim_logical

Alternative logical handler
yaml.load

Convert a YAML string into R objects
read_yaml

Read a YAML file
as.yaml

Convert an R object into a YAML string