Skip to contents

Add YAML header info and writes a the data.frame into disk. The YAML section includes notes and str(dt).

Usage

obs_write_csvy(
  dt,
  notes,
  out = paste0(tempfile(), ".csvy"),
  sep = ",",
  nchar.max = 80,
  ...
)

Arguments

dt

data.table

notes

notes.

out

outfile path.

sep

The separator between columns. Default is ",".

nchar.max

Max nchar for str.

...

extra data.table arguments

Examples

if (FALSE) { # \dontrun{
# Do not run
df <- data.frame(a = rnorm(n = 10),
                 time = Sys.time() + 1:10)

f <- paste0(tempfile(), ".csvy")
notes <- c("notes",
           "more notes")
obs_write_csvy(dt = df, notes = notes, out = f)
readLines(f)
data.table::fread(f, h = TRUE)
} # }