I am trying to repeat a for loop in R for a fixed number of times. Here is a sample of the code I want to repeat
for (i in 1:nrow(data)) { if (i>130){ data$deltas[i]=-((-data$p[i]))*data$alphas[i] } else { data$deltas[i]= ((-(((data$p[i+1])-(data$p[i])))*data$alphas[i]) + data$deltas[i+1]) }}
I do not have any conditions that need to be met, just need to run the same code over the same dataset n times.