Skip to contents

Exports a data.frame and a yamlet version of its decorations. A wrapper for write.table.

Usage

# S3 method for class 'data.frame'
io_table(
  x,
  file = "",
  ext = getOption("yamlet_extension", ".yaml"),
  meta = stdout(),
  useBytes = FALSE,
  default_keys = getOption("yamlet_default_keys", list("label", "guide")),
  ...
)

Arguments

x

data.frame

file

passed to write.table

ext

= extension for metadata equivalent of x

meta

passed as con to io_yamlet

useBytes

passed to io_yamlet

default_keys

passed to io_yamlet

...

passed to write.table (if accepted) and to io_yamlet

Value

invisible(file)

Examples

example(io_table)
#> 
#> io_tbl> # generate some decorated data
#> io_tbl> file <- system.file(package = 'yamlet', 'extdata','quinidine.csv')
#> 
#> io_tbl> x <- decorate(file)
#> 
#> io_tbl> # get a temporary filepath
#> io_tbl> out <- file.path(tempdir(), 'out.tab')
#> 
#> io_tbl> # save file using io_table (returns filepath)
#> io_tbl> foo <- io_table(x, out)
#> 
#> io_tbl> stopifnot(identical(out, foo))
#> 
#> io_tbl> # read using this filepath
#> io_tbl> y <- io_table(foo, as.is = TRUE)
#> 
#> io_tbl> # lossless round-trip
#> io_tbl> attr(x, 'source') <- NULL
#> 
#> io_tbl> rownames(x) <- NULL
#> 
#> io_tbl> rownames(y) <- NULL
#> 
#> io_tbl> stopifnot(identical(x, y))