apply.rolling {PerformanceAnalytics} | R Documentation |
Creates a results timeseries of a function applied over a rolling window.
Wrapper function for rollapply
to hide some of the complexity of managing single-column zoo objects.
apply.rolling(R, width = 12, FUN = "mean", na.pad = TRUE, ...)
R |
a vector, matrix, data frame, timeSeries or zoo object of asset returns |
FUN |
any function that can be evaluated using a single set of returns (e.g., rolling beta won't work, but Return.annualized will) |
width |
number of periods to apply rolling function window over |
na.pad |
TRUE/FALSE If TRUE it adds any times that would not otherwise have been in the result with a value of NA. If FALSE those times are dropped. |
... |
any other passthru parameters |
A timeseries in a zoo object of the calculation results
Peter Carl