My data frame consists of 21 columns, for this problem only one is relevant: I want replace values 2 or 3 or 4 or 5 in a column a with the value 1 (in the same column).
beside of doing the code below for any value 2,3,4,5 i'm looking for something more elegant:
df <- df %>% mutate (a = replace(a, a == 2,1))
df <- df %>% mutate (a = replace(a, a == 3,1))
df <- df %>% mutate (a = replace(a, a == 4,1))
df <- df %>% mutate (a = replace(a, a == 5,1))
so i'm just stock with the condition "or" i need create inside the code... any solution?