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 2024-11-14 00:28:30
#> 2: 0.62898204 2024-11-14 00:28:31
#> 3: 2.06502490 2024-11-14 00:28:32
#> 4: -1.63098940 2024-11-14 00:28:33
#> 5: 0.51242695 2024-11-14 00:28:34
#> 6: -1.86301149 2024-11-14 00:28:35
#> 7: -0.52201251 2024-11-14 00:28:36
#> 8: -0.05260191 2024-11-14 00:28:37
#> 9: 0.54299634 2024-11-14 00:28:38
#> 10: -0.91407483 2024-11-14 00:28:39