tests/testthat/test-argmin.R

test_that("argmin/argmax", {
  expect_equal(argmin(c(8, 6, 9, 7)), 2)
  expect_equal(argmax(c(8, 6, 9, 7)), 3)
})

test_that("pargmin/pargmax", {
  expect_equal(pargmin(c(7, 8, 9), c(9, 8, 7)), c(1, 1, 2))
  expect_equal(pargmax(c(7, 8, 9), c(9, 8, 7)), c(2, 1, 1))
})

Try the cases package in your browser

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

cases documentation built on April 3, 2025, 9:24 p.m.