I have a dataframe that looks like this
df <- data.frame(task       = c(1, 2,  3, 4, 5, NA),
                 day        = c(10, 6,  7, 9, 9, 10),
                 deadline   = c(7, 12, 9, 7, 9, NA),
                 completion = c(1, 1,  1, 1, 0, NA))
Now I want to create a dummy variable that shows if a task was overdue on the day of completion, therefore I have created this code, somehow it does not give me the right results.
df$overduetask <- ifelse(df$completion == 1 & df$day > df$deadline, 1,0)
So my thought behind this is, if a task was completed (completion = 1) and the day is greater than the deadline, then the task is overdue. The output i get for the overdue variable is only 0's, which i manually checked and cannot be true.
 
    