Apply a specified function to data over a given
interval, where the interval is taken to be
the data from INDEX[k] to INDEX[k+1], for
k=1:(length(INDEX)-1).
Usage
period.apply(x, INDEX, FUN, ...)
Arguments
x
data to apply FUN to
INDEX
numeric vector specifying indexing
FUN
an argument of type function
...
additional arguments for FUN
Details
Similar to the rest of the apply family, calculate
a specified functions value given a shifting set
of data values. The primary difference is that it
is that period.apply applies a function to non-overlapping
intervals along a vector.
Useful for applying arbitrary functions over
an entire data object by an aribirtary index,
as when INDEX is the result of a call
to breakpoints.