I have some data and I found some outliers to revise. But instead of replace all values in that column, I want to use certain specific criteria to replace the outliers in that column.
For example, in column day, I want to replace 80 to 8, 70 to 7 for the participant who has UniqueKey == 1234 and UniqueKey == 1321.
And for participant whose UniqueKey == 1484, I want to replace column month value from 79 to 09, and column day to 7.
Like that replace with multiple conditions, how can I achieve that?
Thanks a lot.
This is my code, it does not work at all.
jimma3n<-jimma3 %>%
        select(Enterdateofexam,Enterdateofexam2, Enterdayofexam, UniqueKey,MEDICALRECORD)%>%
        mutate(
                 day=str_replace_all(day,c("80"="8","70"="7")),
                 month=str_replace(month,"25"="05"),
                 if_else((UniqueKey=="1484" & month=="79"), (day=="7"& month=="09") )
              )
 
    