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
See also
Other helpers:
fex(),
obs_footname(),
obs_format(),
obs_freq(),
obs_list.dt(),
obs_out(),
obs_rbind(),
obs_read_csvy(),
obs_roundtime(),
obs_trunc(),
rtorf-deprecated,
sr()
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)
} # }