I'm trying to write a loop that will iterate through columns 64:111
in a data frame, and set [64,1] = 0
, then [65,1:2] = 0
, then [66,1:3] = 0
etc (Months_out starts at 0
and increments by 1
). I can't tell why my loop is only running once, what am I doing wrong?
for (i in 64:111) {
Prod1[cbind(1:Prod1$Months_Out+1,i)] <- 0
}