ztsdb types have been renamed to match the types in the
nanotime
R package. The four temporal types, nanotime
, nanoival
,
nanoduration
and nanoperiod
now have the same name in R and in
ztsdb, making the interface between ztsdb and R even closer.
Additionally, ztsdb's time-series type zts
no longer maps to an
xts
but instead maps to a data.table
with a first column of type
nanotime
. This first column has the name index
.
This means that the R interface no longer suffers from not being able to represent the nanosecond precision in R that is native to ztsdb.
Here is an example of the new mapping (supposing we have a connection
c1
):
c1 ? ++data.table(index = as.nanotime("1970-01-01 UTC") + 1:9, data=1:9)
## with the following output
# index data
# 1: 1970-01-01T00:00:00.000000001+00:00 1
# 2: 1970-01-01T00:00:00.000000002+00:00 2
# 3: 1970-01-01T00:00:00.000000003+00:00 3
# 4: 1970-01-01T00:00:00.000000004+00:00 4
# 5: 1970-01-01T00:00:00.000000005+00:00 5
# 6: 1970-01-01T00:00:00.000000006+00:00 6
A data.table
is created in R (remember that the ++
escape operator
means that the data.table
expression will be evaluated in R), sent
over as part of the query and then the head
function (which is not
escaped) is applied on the ztsdb end to return the first 6 rows of the
zts
:
This type of query is of course not particularly useful, but it shows how close the interface between R and ztsdb is.