Was wondering if anyone would be able to help me in turning an ifelse() statement into case_when(), accompanied with mutate to create a new variable.
I haven't attached a reprex as I'm unsure if it would be needed, but will add one if so.
Thanks for any help.
ifelse(adherence.test$date %in% exac.filter$exac.start &
adherence.test$patientid %in% exac.filter$patientid,
as.character(adherence.test$date), NA)
#Attempt
adherence.test <- Adherence.merge %>%
mutate(exac.date = ifelse(adherence.test$date %in%
exac.filter$exac.start & adherence.test$patientid %in%
exac.filter$patientid, as.character(adherence.test$date),
TRUE ~ NA))
Error: Column `exac.date` must be length 1 (the group size), not 320