# new DTSg object
DT <- data.table::data.table(
date = flow$date,
flow1 = flow$flow - abs(rnorm(nrow(flow))),
flow2 = flow$flow,
flow3 = flow$flow + abs(rnorm(nrow(flow)))
)
x <- DTSg$new(values = DT)
# mean and standard deviation of multiple measurements per timestamp
## R6 method
x$rowaggregate(
resultCols = "flow",
fun = list(mean = mean, sd = sd)
)$print()
## 'raggregate()' is a "hidden" R6 alias for 'rowaggregate()'
x$raggregate(
resultCols = "flow",
fun = list(mean = mean, sd = sd)
)$print()
## S3 method
print(rowaggregate(
x = x,
resultCols = "flow",
fun = list(mean = mean, sd = sd)
))
Run the code above in your browser using DataLab