I am trying to create a check if value is assigned then execute code other wise the same data frame:
for eg if column name of data frame is assigned values
df6 <- data.frame(name=c("try,xab","xab,Lan","mhy,mun","vgtu,mmc","dgsy,aaf","kull,nnhu","hula,njam","mund,jiha","htfy,ntha","bhr,gydbt","sgyu,hytb","vdti,kula","mftyu,huta","ibdy,vcge","cday,bhsue","ajtu,nudj"),
email=c("xab.try@ybcd.com","Lan.xab@ybcd.com","tth.vgu@ybcd.com","mmc.vgtu@ybcd.com","aaf.dgsy@partnt.com","nnhu.kull@ybcd.com","njam.hula@ybcd.com","jiha.mund@ybcd.com","ntha.htfy@ybcd.com","gydbt.bhr@ybcd.com","hytb.sgyu@ybcd.com","kula.vdti@ybcd.com","huta.mftyu@ybcd.com","ggat.khul@ybcd.com","bhsue.cday@ybcd.com","nudj.ajtu@ybcd.com"))
BB=TRUE
col_drop <- c("partnt.com")
df6 <- mutate(df6, email = if_else(BB==TRUE & grepl(col_drop, email), email, NULL)) # skip this line if BB= FALSE or BB= ""
I just want to skip the step if BB = False
just a solution to skip any check if var = "" or var not provided