Mutate dataframe for conditions

I have a data frame like below, HOD_ID and Dept _ID can be different but in this case is same

df <- data.frame(HOD_ID =c("DEV2962","KTN2252","ANA2719","ITI2624","DEV2698","HRT2921","","KTN2624","ANA2548","ITI2535","DEV2732","HRT2837","ERV2951","KTN2542","ANA2813","ITI2210"),
                DEPT_ID = c("DEV2962","KTN2252","ANA2719","ITI2624","DEV2698","HRT2921","ERV0000","KTN2624","ANA2548","ITI2535","DEV2732","HRT2837","ERV2951","KTN2542","ANA2813","ITI2210"),
                city=c("del","mum","nav","pun","bang","chen","triv","vish","del","mum","bang","vish","bhop","kol","noi","gurg"),
                first_name= c("akash","rahul","salman","ram","nkunj","prabal","sanu","kunal","lakhan","praveen","sarman","zuber","giriraj","lokesh","pooja","nikita"),
                last_name= c("dev","singh","abbas","lal","singh","garg","ali","singh","tomar","thakur","ali","khan","singh","sharma","pawar","sharma"))

from this database i am trying to create script like i will ask user

DEPT_ID = ""
City = "Neglect"

then according to this entries i will do some checks on database

  1. if HOD_ID is blank for given Dept_ID
  2. if rows in HOD_ID is not empty except for given Dept_ID
  3. if Dept_ID is not having any empty cell
  4. at last if City = "Neglect" then convert the City column null(blank)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.