write_yamlet: Write Yamlet

View source: R/yamlet.R

write_yamletR Documentation

Write Yamlet

Description

Writes yamlet to file. Similar to io_yamlet.yamlet but returns invisible storage format instead of invisible storage location.

Usage

write_yamlet(
  x,
  con = stdout(),
  eol = "\n",
  useBytes = FALSE,
  default_keys = getOption("yamlet_default_keys", list("label", "guide")),
  fileEncoding = getOption("encoding"),
  block = FALSE,
  ...
)

Arguments

x

something that can be coerced to class 'yamlet', like a yamlet object or a decorated data.frame

con

passed to writeLines

eol

end-of-line; passed to writeLines as sep

useBytes

passed to writeLines

default_keys

character: default keys for the first n anonymous members of each element

fileEncoding

if con is character, passed to file as encoding

block

whether to write block scalars

...

passed to as_yamlet and to as.character.yamlet

Value

invisible character representation of yamlet (storage syntax)

See Also

decorate.list

Other interface: canonical.decorated(), classified.data.frame(), decorate.character(), decorate.data.frame(), desolve.decorated(), ggplot.decorated(), io_csv.character(), io_csv.data.frame(), io_res.character(), io_res.decorated(), io_table.character(), io_table.data.frame(), io_yamlet.character(), io_yamlet.data.frame(), is_parseable.default(), mimic.default(), modify.default(), promote.list(), read_yamlet(), resolve.decorated(), scripted.default(), selected.default()

Examples

library(csv)
file <- system.file(package = 'yamlet', 'extdata','quinidine.csv')
meta <- system.file(package = 'yamlet', 'extdata','quinidine.yaml')
x <- as.csv(file)
y <- read_yamlet(meta)
x <- decorate(x, meta = y)
identical(x, decorate(file))
tmp <- tempfile()
write_yamlet(x, tmp)
stopifnot(identical(read_yamlet(meta), read_yamlet(tmp)))

bergsmat/yamlet documentation built on Feb. 18, 2024, 5:50 a.m.