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-07-24 19:17:37
#> 2: 0.44479712 2025-07-24 19:17:38
#> 3: 2.75541758 2025-07-24 19:17:39
#> 4: 0.04653138 2025-07-24 19:17:40
#> 5: 0.57770907 2025-07-24 19:17:41
#> 6: 0.11819487 2025-07-24 19:17:42
#> 7: -1.91172049 2025-07-24 19:17:43
#> 8: 0.86208648 2025-07-24 19:17:44
#> 9: -0.24323674 2025-07-24 19:17:45
#> 10: -0.20608719 2025-07-24 19:17:46