tests/testthat/integration_tests/test_case_when.R

test_that("case_when can be used in anonymous functions (#3422)", {
  res <- tibble::tibble(a = 1:3) %>%
    dplyr::mutate(b = (function(x) case_when(x < 2 ~ TRUE, TRUE ~ FALSE))(a)) %>%
    dplyr::pull()
  expect_equal(res, c(TRUE, FALSE, FALSE))
})

Try the lest package in your browser

Any scripts or data that you put into this service are public.

lest documentation built on Jan. 11, 2020, 9:37 a.m.