Skip to content

Commit

Permalink
aggreate forward instead of backward.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Marty committed Feb 13, 2018
1 parent dd35898 commit 026cb56
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eric-figs/fig1_new_variance.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ tychoL1.measles.CA.cases.imp.zoo.statswindow <- window(tychoL1.measles.CA.cases.
tmpfcn <- function(x,agg.interval=1) {
index <- index(x)
interval <- mean(diff(index))
agg.groups <- rep(seq(index[length(index)], index[1], -interval*agg.interval), each=agg.interval)
agg.groups <- rev(agg.groups[1:length(x)])
# forwards:
agg.groups <- rep(seq(index[1], index[length(index)], interval*agg.interval), each=agg.interval)
agg.groups <- agg.groups[1:length(x)]
# reverse:
# agg.groups <- rep(seq(index[length(index)], index[1], -interval*agg.interval), each=agg.interval)
# agg.groups <- rev(agg.groups[1:length(x)])
out <- aggregate(x, by = agg.groups, sum)
return(out)
}
Expand Down

0 comments on commit 026cb56

Please sign in to comment.