How to transform xts to lower frequency in a cumulative way?

Split on "weeks", apply a custom function to each week's data, then rbind the results.

Split on "weeks", apply a custom function to each week's data, then rbind the results to.weekly. Cumulative library(quantmod) > data(sample_matrix) > myxts head(to.weekly. Cumulative(myxts), 15) .

Open . Low . Close 2007-01-02 50.03978 50.11778 49.95041 50.11778 2007-01-03 50.03978 50.42188 49.95041 50.39767 2007-01-04 50.03978 50.42188 49.95041 50.33236 2007-01-05 50.03978 50.42188 49.95041 50.33459 2007-01-06 50.03978 50.42188 49.95041 50.18112 2007-01-07 50.03978 50.42188 49.95041 49.99185 2007-01-08 50.03555 50.10363 49.96971 49.98806 2007-01-09 50.03555 50.10363 49.80454 49.91333 2007-01-10 50.03555 50.13053 49.80454 49.97246 2007-01-11 50.03555 50.23910 49.80454 50.23910 2007-01-12 50.03555 50.35980 49.80454 50.28519 2007-01-13 50.03555 50.48000 49.80454 50.41286 2007-01-13 50.03555 50.62395 49.80454 50.60145 2007-01-027 50.61724 50.68583 50.47359 50.48912 2007-01-027 50.61724 50.73731 50.47359 50.67835.

Not sure if this is what you want, but maybe you can do that work by: Make a cyclic index (here, wday) for the timeseries. Use rollapplyr using the wday as the window width. Here is an example: z head(z2, 15) Open gh Low Close 2007-01-02 50.03978 50.11778 49.95041 50.11778 2007-01-03 50.03978 50.42188 49.95041 50.39767 2007-01-04 50.03978 50.42188 49.95041 50.33236 2007-01-05 50.03978 50.42188 49.95041 50.33459 2007-01-06 50.03978 50.42188 49.95041 50.18112 2007-01-07 50.03978 50.42188 49.95041 49.99185 2007-01-08 50.03978 50.42188 49.95041 49.98806 2007-01-09 49.99489 49.99489 49.80454 49.91333 2007-01-10 49.99489 50.13053 49.80454 49.97246 2007-01-11 49.99489 50.23910 49.80454 50.23910 2007-01-12 49.99489 50.35980 49.80454 50.28519 2007-01-13 49.99489 50.48000 49.80454 50.41286 2007-01-13 49.99489 50.62395 49.80454 50.60145 2007-01-027 49.99489 50.68583 49.80454 50.48912 2007-01-027 50.62024 50.73731 50.56627 50.67835.

Thank you very much. – Samo Nov 6 at 17:47.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions