inst/tinytest/test_create_neighborhood.R

diagonal_matrix = matrix(c(1, NA, 1,
                           NA, 0, NA,
                           1, NA, 1),
                         3, 3,
                         byrow = TRUE)

r1 = comat:::create_neighborhood(diagonal_matrix)
t1 = structure(c(-1L, 1L, -1L, 1L, -1L, -1L, 1L, 1L),
               .Dim = c(4L, 2L))

expect_equivalent(r1, t1)

Try the comat package in your browser

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

comat documentation built on April 5, 2023, 5:12 p.m.