I want basically to calculate a cumulative return (and an Index value) for a xts time series for which I have a return for each period. But since I'm looking at defined periods to compare these time series I want the cumulative return and Index value from the beginning of this period to the end and the current cumulative return in each row.
Lets say my data is something like this (and the base index value is 100):
Return Index Cumulative Return
Date0 0 100 0
Date1 0.05 105 0.05
Date2 0.10 115.5 0.155
Date3 -0.1 103.95 0.0395
How can I achieve that in R?