tests/testthat/test-terra_jaccard.r

test_that("terra_jaccard works", {
  # Set seed for reproducibility
  set.seed(42, "Mersenne-Twister", sample.kind="Rejection")
  
  x <- terra::rast(matrix(rbinom(100, 1, 0.2), nrow=10))
  y <- terra::rast(matrix(rbinom(100, 1, 0.8), nrow=10))
  expect_equal(prior3D::terra_jaccard(x, y), 0.24705882352941177516)
})

Try the prior3D package in your browser

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

prior3D documentation built on April 11, 2025, 5:39 p.m.