I can't find a way to return multiple values (columns) or just a tibble from case_when()
.
input <- tibble(a = c(1, 2, 3))
input %>%
mutate(
case =
case_when(
a == 1 ~ tibble(x = "case1", y = "c1"),
a == 2 ~ tibble(x = "case2", y = "c2"),
a == 3 ~ tibble(x = "case3", y = "c3")
)
)
How can I set multiple parameters depending on some regex conditions?