Learn R Programming

opentsdbr (version 0.1)

aggregate.tsdb: aggregate.tsdb

Description

Aggregate a 'data.tsdb' object

Usage

aggregate.tsdb(x, by = list(), FUN = list(), seconds = 60, ..., simplify = TRUE)

Arguments

by
(optional) named list of grouping variable(s)
FUN
named list of statistics or functions
seconds
temporal resolution (to which timestamps are truncated)
...
further arguments to `[.data.table`
simplify
logical; drop unused columns (unimplemented)

Examples

Run this code
## Not run: 
# require(zoo)
# require(lubridate)
# data(co2)
# x <- ISOdate(1959, 01, 01, 00) + dyears(index(as.zoo(co2)) - 1959)
# co2 <- as.tsdb(data.frame(timestamp=x, value=as.numeric(co2)))
# aggregate(co2, seconds=60 * 60 * 24 * 365 * 5)
# ## End(Not run)

Run the code above in your browser using DataLab