Posts by user79376 • 21 points
1 post
-
2
votes1
answer61
viewsQ: Is it possible to convert this for loop to an apply family function?
df_loop <- data.frame(data1, data2, data3, 0) for (i in 4:nrow(df_loop[1])) { tmp_1 = df_loop[i,1] tmp_2 = df_loop[i,2] tmp_2_lag3 = df_loop[i-3,2] tmp_3 = df_loop[i,3] if (!is.na(tmp_2_lag3)) {…