# NOT RUN {
library(data.table)
test_df <- tidytable(
a = 1:10,
b = 11:20,
c = c(rep("a", 6), rep("b", 4)),
d = c(rep("a", 4), rep("b", 6)))
test_df %>%
mutate.(x = case.(b < 13, 3,
a > 4, 2,
default = 10))
test_df %>%
mutate.(x = case.(c == "a", "a",
default = d))
# }
Run the code above in your browser using DataLab