tests/testthat/test_TaskRegrST.R

test_that("TaskRegrST throws an error when backend is an sf object", {
  stack = generate_stack(list(
    numeric_layer("x_1"),
    numeric_layer("y")),
  dimension = 100)
  vector = st_as_sf(sample_stack(stack, n = 100))

  expect_error(TaskRegrST$new(id = "test", backend = vector, target = "y"), "convert an sf objects into a task")
})

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.