Hi there,
for me something weird is happening in my R-Script... Im using the statement below. tmp1 and tmp2 just return TRUE/FALSE and not 0 or the result of the sequence function.
Do you have any idea?
dt_DAY[, tmp1 := ifelse(KT_fd == 1,sequence(rle(as.character(KT_fd))$lengths),0), by=id]
dt_DAY[, tmp2 := ifelse(tmp1== 0,1,0),by=id]
dt_DAY[, tmp2 := shift(tmp2, 1),by=id]
dt_DAY[, KT_fsdi0 := tmp1 * tmp2]