Hi,
I want to get the percent of cases with receivedt = collectdt.
I created the following sample df and tried the code below but it did not work.
LAB <- data.frame(name = c("Jon", "Bill", "Maria", "Ben", "Tina", "Sally", "George", "Simon"),
collectdt = c(06/01/2011, 06/05/2011, 09/08/2012, 11/05/2020, 06/01/2011, 09/08/2012, 02/09/2015, 10/14/2022),
receivedt = c(06/01/2011, 11/05/2020, 01/12/2019, NA, 08/03/2017, 05/07/2011, 12/08/2021, 10/14/2022)
)
LAB<-LAB %>%
mutate(collectdt = if_else(is.na(collectdt), receivedt, as.Date(collectdt)))%>%
Am I using the wrong code or missing something?
I appreciate your help.
Thank you