Suppose I have a data frame df
df <- tribble( ~x, ~y, 1, 'x > 3', 5, 'x > 2', 10, 'x > 1' )
I want to create a new variable z by the condition in y, say
df %>% mutate(z = if_else(condition, 1, 0))
here the condition is in column y.
Can I create the new variable in tidy way?