tests/testthat/test-vector_occurrence.R

test_that("finding occurrence in vector works", {
  x <- c("A", "A", "B", "C", "A")
  expect_equal(vector_occurrence(x, "first"), c(1L, 3L, 4L))
  expect_equal(vector_occurrence(x, "last"), c(5L, 3L, 4L))
})

Try the oeli package in your browser

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

oeli documentation built on Oct. 16, 2024, 5:08 p.m.