inst/tinytest/test_moran_NA.R

library(spdep)
data(oldcol)
lw <- nb2listw(COL.nb, style="W")
is.na(COL.OLD$CRIME) <- 1
expect_error(o <- moran.test(COL.OLD$CRIME, lw))
expect_warning(o <- moran.test(COL.OLD$CRIME, lw, na.action=na.pass))
expect_silent(o <- moran.test(COL.OLD$CRIME, lw, na.action=na.omit))

Try the spdep package in your browser

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

spdep documentation built on June 10, 2025, 9:07 a.m.