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.55369938 2025-04-01 17:30:51
#> 2: 0.62898204 2025-04-01 17:30:52
#> 3: 2.06502490 2025-04-01 17:30:53
#> 4: -1.63098940 2025-04-01 17:30:54
#> 5: 0.51242695 2025-04-01 17:30:55
#> 6: -1.86301149 2025-04-01 17:30:56
#> 7: -0.52201251 2025-04-01 17:30:57
#> 8: -0.05260191 2025-04-01 17:30:58
#> 9: 0.54299634 2025-04-01 17:30:59
#> 10: -0.91407483 2025-04-01 17:31:00