lundi 22 mai 2017

check sequentially a column in R and add 1 or 0

I would like to do in r something equivalent that I do in excel:

IF(B3-[@[lagged Date]]>2,1,0)

In fact, it is just the previous row. Writing pseudo language could be considered as follows: If(x-x_i>y,1,0)

Any way to do it with an explanation, please?

I am struggling with the way to go back and iterate over a column and go through each row using r.

Aucun commentaire:

Enregistrer un commentaire