Datetime data has a "resolution", the units of the values. resolution() exposes that property and resolution<- lets you set it. "Rollups" are a way of binning datetime data into meaningful units. rollup() lets you create an expression that you can query with. Datetime variables also have a rollupResolution() attribute that is the default resolution they will roll-up to, if not specified in rollup(); rollupResolution<- lets you set that.


resolution(x) <- value

rollup(x, resolution = rollupResolution(x))


rollupResolution(x) <- value



a Datetime variable


a resolution string. Valid resolutions in Crunch are c("Y", "Q", "M", "W", "D", "h", "m", "s", "ms"). NULL is also valid for rollupResolution<- but not for resolution<-.


Same as value, in rollup(). This may be NULL, in which case the server will determine an appropriate resolution based on the range of the data.


resolution() and rollupResolution() return the resolution string for datetime variables, NULL otherwise. The setters return the variable entity after modifying the state on the server. rollup() returns a CrunchExpr expression.


Note that resolution is a property of the data while rollupResolution is metadata. Setting resolution alters the column data, and if setting a more coarse resolution (e.g. going from "s" to "m"), it cannot be reversed. Setting rollupResolution is non-destructive.


if (FALSE) { resolution(ds$starttime) ## [1] "ms" resolution(ds$starttime) <- "s" rollup(ds$starttime) rollup(ds$starttime, "D") rollupResolution(ds$starttime) <- "D" crtabs(~ rollup(starttime), data = ds) }