tests/testthat/test_data.R

test_that("categorical layer is set", {
  stack = generate_stack(list(
    factor_layer("y", levels = c("a", "b"))),
  dimension = 2)
  task = as_task_unsupervised(stack)
  expect_factor(task$data()$y, levels = c("a", "b"), len = 4)
})

Try the mlr3spatial package in your browser

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

mlr3spatial documentation built on Aug. 12, 2025, 1:08 a.m.