| write_ts_table | R Documentation |
Write time-series data to files.
write_ts_table(ts, dir, file, add = FALSE, overwrite = FALSE,
replace.file = FALSE, backend = "csv")
ts |
a |
dir |
character |
file |
character |
add |
logical: if |
overwrite |
logical: overwrite existing file when data
differs. |
replace.file |
logical: if |
backend |
a string; currently, only |
The function takes a ts_table and writes it to
a file.
If the file already exists and both add and
overwrite are FALSE (the default),
nothing is written.
When add is TRUE, the function checks
if ts contains timestamps not yet in the file
and, if there are any, writes only those data.
When overwrite is TRUE, the function
merges all observations in the file with those in
ts and writes the result back to the file. If
ts contains timestamps that were already in the
file, the data in the file are overwritten. Note that
no data will be removed from the file: timestamps not
in ts remain unchanged in the file.
Invisibly, the number of data rows written to a file.
Enrico Schumann
read_ts_tables
t1 <- ts_table(1:3, as.Date("2018-12-3") + 1:3, columns = "A")
t2 <- ts_table(4:5, as.Date("2018-12-3") + 1:2, columns = "A")
d <- tempdir() ## this is just an example.
## Actual (valuable) data should never
## be stored in a tempdir!
write_ts_table(t1, dir = d, file = "t1")
write_ts_table(t2, dir = d, file = "t2")
read_ts_tables(c("t1", "t2"),
dir = d, columns = "A",
return.class = "zoo",
column.names = "%file%.%column%")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.