I'm trying to create a dummy variable for specific dates (covid effect)
When using the code below, got only NA's in the column.
df$dummy <- ifelse(df$date > as.Date("2018-01-01", format = "%Y/%m/%d") &
df$date < as.Date("2020-06-15", format = "%Y/%m/%d"), 1, 0)
Does anyone know how to fix it?