How can I use the lag function to skip over rows and provide number of previous occurrences
I have a dataframe with the first three columns ‘Person’, ‘NoShow’, and ‘date’. I want to create the two additional columns ‘prior_noshow’ and ‘prior_noshow_f’, but I cannot figure out how to do this using the lag function. Person NoShow date prior_noshow prior_noshow_f 1 123 0 2019-01-01 NA NA 2 123 1 2019-04-01 0 0 3… Read More How can I use the lag function to skip over rows and provide number of previous occurrences