Differences with R



ztsdb array types can be persisted to disk. See the reference section Durability and the discussion about persistence in the reference section Arrays of the reference document.


ztsdb arrays can be locked for copying. See run section Locking.

New types

connection, timer, duration, period, interval, time, zts are all new types in ztsdb.

duration, period, interval, time are array types. zts is a combined type with a time index and double data part.

Note that the above types are true arrays; they are n-dimensional and have array indexing semantics, etc.. This is not the case in R for non-base types; in particular it is only possible to define vectors of POSIXct.


ztsdb does not have NA. All values of duration, period, interval, time, character and logical are valid. double has NaN, but not NA. The NaN semantic is that of the CPU's floating point unit.

Type conversion

Since any object may be permanent and potentially very large, ztsdb does not allow a type conversion that modifies the type of the object on the left hand side.

### in R
a <- c(1,2,3,4)
a[3] <- "a"       # a is now the character array [1] "1" "2" "a" "4"

### in ztsdb
a <- c(1,2,3,4)
a[3] <- "a"       # Error: conversion not defined for string to double

But type conversions that do not modify the target work like in R:

a <- c("a","b","c","d")
a[3] <- 20        # character array, 20 becomes a string: [1] "a"  "b"  "20" "d" 


In ztsdb, time is integer based and handles nanosecond time. In R POSIXct is (unfortunately) floating point based. This means that various time offsets have different precision. In general though R is not able to express nanosecond precision and rounding errors occur.

This creates issues when importing time into R since the former is converted to POSIXct representation and truncation may occur. Warnings are generated, but this is not a satisfactory solution.


Functions and scoping



Control structures