trailingFUN: apply a function over a configurable trailing period
Description
this function is primarily designed for use with portfolio functions passing
'x' or 'R' and weights, but may be usable for other things as well, see Example for a vector example.
Usage
trailingFUN(R, weights, n = 0, FUN, FUNargs = NULL, ...)
Arguments
R
an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns