read_ts_tables {tsdb} | R Documentation |
Read Time-Series Data from Files
Description
Read time-series data from files and merge them.
Usage
read_ts_tables(file, dir, t.type = "guess",
start, end, columns,
return.class = NULL,
drop.weekends = FALSE,
column.names = "%dir%/%file%::%column%",
backend = "csv",
read.fn = NULL,
frequency = "1 sec",
timestamp)
Arguments
file |
character |
dir |
character |
t.type |
character: |
start |
a timestamp: either of classes It is best to always specify |
end |
a timestamp: either of classes It is best to always specify |
columns |
character. |
return.class |
|
drop.weekends |
logical |
column.names |
character: a format string for column names; may
contain |
backend |
character: currently, only ‘ |
read.fn |
|
frequency |
character; used compute a regular grid between
|
timestamp |
a vector of timestamps: if specified, only data at
the times in |
Details
Read time-series data from CSV files.
Value
When return.class
is NULL
, a list:
data |
a numeric matrix |
timestamp |
Date or POSIXct |
columns |
character |
file.path |
character |
Otherwise an object of class as specified by argument
return.class
.
Author(s)
Enrico Schumann
See Also
Examples
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%")