I have a dataframe that looks like this:
names <- c("Lucy", "Sally", "Harry", "Betsy")
values <- c(1, 2, 3, 4)
df <- data.frame(names, values)
I want to make another column that has a value of Low if the value is 1 or 2, and High if the value is 3 or 4. I can do it like this in base R
df$var[df$values == 1 | df$values == 2] = "Low"
df$var[df$values == 3 | df$values == 4] = "High"
But how do I do it in tidyverse? I've tried using pipes and filter but that hasn't worked so far.