tests/testthat/test-kernel-weights.R

test_that("kernel_weights returns expected length", {
  d <- c(0, 1, 2, 3)
  w <- kernel_weights(d, bandwidth = 3, kernel = "bisquare")
  expect_length(w, 4)
  expect_true(all(w >= 0))
})

test_that("build_neighbors returns valid indices", {
  coords <- cbind(1:5, 1:5)
  nb <- build_neighbors(coords, focal_index = 3, bandwidth = 3, adaptive = TRUE)
  expect_equal(length(nb$neighbor_index), 3)
  expect_true(3 %in% nb$neighbor_index)
})

Try the gwrf package in your browser

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

gwrf documentation built on Aug. 24, 2026, 5:15 p.m.