Nothing
test_that("lat2w returns a correct rook contiguity matrix", {
res <- lat2w(nrows = 3, ncols = 3, rook = TRUE)
expect_named(res, c("nbs", "w"))
w <- res$w
expect_equal(dim(w), c(9, 9))
expect_true(all(w %in% c(0, 1)))
expect_true(all(diag(w) == 0))
expect_equal(w, t(w))
# corner cells have 2 neighbours, the centre cell has 4
expect_equal(sum(w[1, ]), 2)
expect_equal(sum(w[5, ]), 4)
})
test_that("lat2w queen case adds diagonal neighbours", {
res <- lat2w(nrows = 3, ncols = 3, rook = FALSE)
w <- res$w
expect_equal(sum(w[5, ]), 8)
expect_equal(sum(w[1, ]), 3)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.