R vectorized array data manipulation
问题 I think there will be much more people interested into this subject. I have some specific task to do in the most efficient way. My base data are: - time indices of buy and sell signals - on the diag of time indicies I have ROC (rate of change) between closest buy-sell pairs: r <- array(data = NA, dim = c(5, 5), dimnames = list(buy_idx = c(1,5,9,12,16), sell_idx = c(3,7,10,14,19))) diag(r) <- c(1.04,0.97,1.07,1.21,1.1) The task is to generate moving compound ROC on every possible window (buy