df %>%
mutate(g = ifelse(a == 2 | a == 5 | a == 7 | (a == 1 & b == 4), 2,
ifelse(a == 0 | a == 1 | a == 4 | a == 3 | c == 4, 3, NA)))
df <- df %>% mutate(target_bool = case_when(salary == ">50K" ~ TRUE, salary == "<=50K" ~ FALSE))