What's the idiomatic way in R to loop over 2 vectors like this in Python
for i,j in zip(Is, Js)
The obvious way in R is to go along the index
for (idx in seq_along(Is)) {
i = Is[idx]
j = Js[idx]
}
Just wonder if there is a less cumbersome way?
Edit:
I'm using for loop for parameter scan and then plotting. A preferred way to avoid for loop will be also helpful. So for example
results = data.table()
for (threshold in c(2,3,4,5)) {
largeRtn = rtn[abs(rtn)>threshold*volatility]
results = rbind(results, someAnalysis(largeRtn) )
qplot(largeRtn, ...)
}