set.seed(1)
df <- data.frame(b = sample(0:2,5, replace = TRUE),
a = sample(1:10,5, replace = TRUE )
)
df
#> b a
#> 1 0 7
#> 2 2 2
#> 3 0 3
#> 4 1 1
#> 5 0 5
df |>
dplyr::mutate(a = ifelse(b > 1, 1, 0))
#> b a
#> 1 0 0
#> 2 2 1
#> 3 0 0
#> 4 1 0
#> 5 0 0
Created on 2022-02-24 by the reprex package (v2.0.0)
Hi there, as you can see it is working? So I am not sure what you are doing differently in your example then.