Methods to Convert R Data to YAML and Back

Implements the 'libyaml' 'YAML' 1.1 parser and emitter (< https://pyyaml.org/wiki/LibYAML>) for R.


yaml

R-CMD-check Codecov testcoverage

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.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("yaml")

2.3.12 by Hadley Wickham, 10 months ago


https://yaml.r-lib.org, https://github.com/r-lib/yaml/


Report a bug at https://github.com/r-lib/yaml/issues


Browse source code at https://github.com/cran/yaml


Authors: Hadley Wickham [cre] , Shawn Garbett [ctb] , Jeremy Stephens [aut, ctb] , Kirill Simonov [aut] , Yihui Xie [ctb] , Zhuoer Dong [ctb] , Jeffrey Horner [ctb] , reikoch [ctb] , Will Beasley [ctb] , Brendan O'Connor [ctb] , Michael Quinn [ctb] , Charlie Gao [ctb] , Gregory R. Warnes [ctb] , Zhian N. Kamvar [ctb]


Documentation:   PDF Manual  


BSD_3_clause + file LICENSE license


Suggests knitr, rmarkdown, testthat


Imported by BayLum, Capsule, DCC, DataPackageR, Gmisc, IssueTrackeR, LISTC, MetaRVM, OmopViewer, PKbioanalysis, PTXQC, PhilipsHue, REffectivePred, RPhosFate, S7schema, SIAmodules, SIAtools, SeaSondeR, SmokingHistoryGenerator, WMFM, abba, acR, acumos, addinsOutline, aftables, agenticr, agentr, airr, aisdk, ajv, analogsea, andorR, antaresEditObject, artma, aslib, astgrepr, attachment, aurora, auth0, automagic, autoslider.core, bayesEO, bea.R, beadplexr, bedr, binman, biobouncer, biocompute, bitfield, blockr.core, blogdown, bookdown, brand.yml, brandr, bunddev, buoyant, captain, cellKey, cffr, chattr, checker, citation, clinDataReview, cloudml, cometr, config, configr, connector, covr, craftgrn, cre.dcf, crew.cluster, csvy, dados, data.checker, datadiff, dataganger, datapackage, datarobot, dataverifyr, datom, datos, dbProject, dcmodify, deckgl, deident, detzrcr, df2yaml, distill, documenter, downlit, dqcheckr, dqcheckrGUI, dsROCrate, dunlin, dynwrap, easydb, emld, envstat, epitraxr, exams.forge, fdicdata, fiery, file2meco, filters, filters.trade, fireData, flexsiteboard, flir, folders, formods, foundry, fr, framework, frictionless, ftExtra, fusen, geofi, geoflow, geohabnet, ggPMX, ggsql, git2rdata, glossary, glossr, gms, golem, googleCloudStorageR, gooseR, goxygen, gptstudio, grouper, guildai, handlr, harness, heddlr, highcharter, htmlwidgets, ieegio, investdatar, jot, json2aRgs, jubilee, justifier, kesernetwork, keyring, knitr, knitxl, krt, labelmachine, lares, ldhmm, lexsync, licoread, liftr, lightparser, link2GI, litteR, madrat, markmyassignment, mclm, mcptools, memisc, memor, mergenstudio, metaboData, metricminer, mighty.metadata, misha, mlflow, moodlequiz, myownrobs, naryn, nat, nlmixr2rpt, officedown, okf, onbrand, orderly, ottrpal, oysteR, pacha, pacta.multi.loanbook, papaja, parsermd, pensar, pepr, periscope, periscope2, pins, pkgdown, pkgsite, plumber2, plume, pointblank, polished, potions, power4mome, precommit, psyverse, qlcData, qpost, qtl2, quanteda, quarto, querychat, rAccess, rAmCharts, rDataPipeline, rDeckgl, rMosaic, radiant.model, random.cdisc.data, rapiclient, rappleads, rapport, ravepipeline, rb3, rbranding, rccola, rconfig, realestatebr, refdb, repana, reportfactory, restfulr, resultcheck, rfair, rhino, riskweightedassets, rjd3production, rjtools, rlist, rmarkdown, rmcfs, rpgconn, rqti, rsconnect, rticles, ruminate, rworkflows, saros.base, scilintr, sevenbridges2, shelter, shidashi, shiny.i18n, shinyEditor, shinyExprPortal, shinydbauth, shinydrive, shinyelectron, shinymanager, shinyseo, sinew, siteymlgen, sits, snowquery, snpAIMeR, soilKey, sqlhelper, sship, starvz, stevedore, strand, strollur, submitr, surveydown, swirl, swirlify, synadam, table1, tabulergm, tabulog, targets, teal.picks, teal.reporter, telraamStats, tensorflow, texanshootR, texor, tfruns, theoryforge, theorytools, tidycwl, tinytrail, toolero, trace, transltr, tsg, tstools, tutorizeR, ubair, unicefData, usethis, uteals, validate, varitas, vcr, versioning, vitae, washr, wdman, webexercises, wf, whep, whirl, worcs, workflowr, workspace, worrrd, x3ptools, yamlet, yamlme, ymlthis, yorkr, yum, zoteR.

Suggested by EpiQuestionR, FLightR, LaF, MNormTest, MVN, REDCapR, Rclade, ShinyItemAnalysis, ShinyWizard, aNCA, admiralpeds, albersdown, altdoc, apa7, apsimeval, arsenal, biocohort, bmm, brightspaceR, bslib, cdata, civis, cmsafvis, commons, countrycode, crane, data.table, data.tree, dataverse, deli, dipsaus, ekioplot, fcaR, fluffy, froggeR, frontmatter, getaca, gitlabr, grattan, hoopR, hyd1d, iNZightTools, integrity, io, laminr, leprechaun, lgr, linl, logrx, marginaleffects, mark, markdown, mrgsolve, nanonext, nfcore.utils, nhanesdata, pak, path.chain, pharmaversesdtm, plumber, pmxpartab, projmgr, ragR, renv, rio, routr, roxygen2, rpkgkit, rquery, scan, sdcMicro, sfdep, shiny, shiny.webawesome, startR, tablet, tabular, tabxplor, teal, tfdeploy, tibblify, tidyILD, tidySEM, tidypredict, tidytuesdayR, tplyr2, tractor.base, tugboat, uaparserjs, vegawidget, visOmopResults, vivainsights, weightflow, wizaRdry, xfun, xmlrectr.


See at CRAN