tests/testthat/test-doctest-is_nondominated.R

# Generated by doctest: do not edit by hand
# Please edit file in R/nondominated.R

test_that("Doctest: is_nondominated", {
  # Created from @doctest for `is_nondominated`
  # Source file: R/nondominated.R
  # Source line: 33
  S = matrix(c(1, 1, 0, 1, 1, 0, 1, 0), ncol = 2, byrow = TRUE)
  expect_equal(is_nondominated(S), c(FALSE, TRUE, TRUE, FALSE))
  expect_equal(is_nondominated(S, maximise = TRUE), c(TRUE, FALSE, FALSE, FALSE))
  expect_equal(filter_dominated(S), matrix(c(0, 1, 1, 0), ncol = 2, byrow = TRUE))
  expect_equal(filter_dominated(S, keep_weakly = TRUE), matrix(c(0, 1, 1, 0, 1, 0),
  ncol = 2, byrow = TRUE))
  expect_equal(any_dominated(S), TRUE)
  expect_equal(any_dominated(S, keep_weakly = TRUE), TRUE)
  expect_equal(any_dominated(filter_dominated(S)), FALSE)
  three_fronts = matrix(c(1, 2, 3, 3, 1, 2, 2, 3, 1, 10, 20, 30, 30, 10, 20, 20,
    30, 10, 100, 200, 300, 300, 100, 200, 200, 300, 100), ncol = 3, byrow = TRUE)
  expect_equal(pareto_rank(three_fronts), c(1, 1, 1, 2, 2, 2, 3, 3, 3))
  split.data.frame(three_fronts, pareto_rank(three_fronts))
})

Try the moocore package in your browser

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

moocore documentation built on Jan. 11, 2026, 9:06 a.m.