SyntaxFix
Write A Post
Hire A Developer
Questions
You can do this :
df <- data.frame("a" = c(1,2,3,4), "b" = c(4,3,2,1), "x_ind" = c(1,0,1,1), "y_ind" = c(0,0,1,1), "z_ind" = c(0,1,1,1) ) df %>% mutate( bi = ifelse((df$x_ind + df$y_ind +df$z_ind)== 3, 1,0 ))