I have a dataframe ,df. I would like to divide value by 5 when RCM_GCM is either CAN or HAD.
Else, I would like to multiple by 3.
I tried the following.
RCM_GCM="HAD" df=data.frame( dt=seq(1:5), value=c(10,15,5,0,55) ) hist1=df %>% mutate(valu_his=ifelse(RCM_GCM%in% c("CAN","HAD"), value/5, value*3) )