# NOT RUN {
x <- c(1:4, 3:2, 1:4)
ifelse.(x > 2L, x, x - 1L)
# Can also be used inside of mutate.()
test_df <- data.table::data.table(x = x)
test_df %>%
mutate.(new_col = ifelse.(x > 2L, NA, x - 1L))
# }
Run the code above in your browser using DataLab