Add YAML header info and writes a the data.frame into disk. The YAML section includes notes and str(dt).
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
{
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)
}
#> a time
#> <num> <POSc>
#> 1: -0.25148344 2025-09-26 21:00:57
#> 2: 0.44479712 2025-09-26 21:00:58
#> 3: 2.75541758 2025-09-26 21:00:59
#> 4: 0.04653138 2025-09-26 21:01:00
#> 5: 0.57770907 2025-09-26 21:01:01
#> 6: 0.11819487 2025-09-26 21:01:02
#> 7: -1.91172049 2025-09-26 21:01:03
#> 8: 0.86208648 2025-09-26 21:01:04
#> 9: -0.24323674 2025-09-26 21:01:05
#> 10: -0.20608719 2025-09-26 21:01:06