x <- c(1, 1, 4, 2, 2, 6, 7, 8, -1, 20)
i <- c(0, 3, 5, 8, 10)
period.sum(x, i)
period.prod(x, i)
period.min(x, i)
period.max(x, i)
data(sample_matrix)
y <- sample_matrix[, 1]
ep <- endpoints(sample_matrix)
period.sum(y, ep)
period.sum(as.xts(y), ep)
period.prod(y, ep)
period.prod(as.xts(y), ep)
period.min(y, ep)
period.min(as.xts(y), ep)
period.max(y, ep)
period.max(as.xts(y), ep)
Run the code above in your browser using DataLab