tests/testthat/test_cross_join.R

test_that("cross_join", {
  tab = cross_join(list(a = 1:3, b = 1:2))
  expect_equal(tab, CJ(a = 1:3, b = 1:2))

  tab = cross_join(list(sorted = 1:3, b = 1:2))
  expect_equal(tab, setnames(CJ(a = 1:3, b = 1:2), "a", "sorted"))

  tab = cross_join(list(unique = 1:3, b = 1:2))
  expect_equal(tab, setnames(CJ(a = 1:3, b = 1:2), "a", "unique"))
})

Try the mlr3misc package in your browser

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

mlr3misc documentation built on April 4, 2025, 1:51 a.m.