Scenario:
Let's say x = 1
on 2000 Jan 15.
So calendar_date
column with 2000-01-15
value
Expected result:
Then x_lead := 1
on 2000 Jan 14
and x_lag := 1
on 2000 Jan 16
First, how do I detect that 2000-01-14
exists in the calendar_date
column?
Then, how would I df |> mutate(x_lead = 1)
at the 2000-01-14
row?