row-wise iteration in a dataframe where each row depends on previous values

Hi Christophe,

Thanks so much for that, that's a really elegant solution. I had looked at accumulate() before but couldn't figure out how to apply it to this type of problem.

I realise now that my reprex is perhaps overly simplified and doesn't capture what it is that I'm trying to do...

I've posted a follow-up here.

2 Likes