# Return.portfolio function for re-balancing with time series of weights

I am using the Return.portfolio function from the PerformanceAnalytics R package in order to re-balance the portfolio based on different frequencies (i.e. daily, weekly monthly, etc.) using a time series of weights. The function works fine when using a static weight-vector such as c(0.6, 0.2, 0.2) but when using the time series weight matrix the function produces the same result for all re-balancing frequencies, i.e.

r.p.dynRP.d = Return.portfolio(ret["1997-01-30/2018-01-05"], weights=weight_matrix, rebalance_on="days")

yields the same result as

r.p.dynRP.y = Return.portfolio(ret["1997-01-30/2018-01-05"], weights=weight_matrix, rebalance_on="years")

ret and weight_matrix are both xts objects with the same dimensions and the same indexclass=date.

I think the function re-balances daily for all frequencies. Any idea why this is case? Is there perhaps a better way for the calculation of periodic re-balancing based on changing portfolio weights?

It actually works if you convert the (time series) weight matrix to the frequency you want to use for re-balancing using, e.g. apply.weekly(weight_matrix). The return matrix should still be daily data. I.e. the following code worked for me:
weight_matrix.w=apply.weekly(weight_matrix, last)