if(require("ade4", quietly = TRUE) & require("spdep", quiet = TRUE)){
data(mafragh)
tests <- moranNP.randtest(mafragh$env[,1], nb2listw(mafragh$nb),
alter = "two-sided", p.adjust.method = "holm")
tests
moran.randtest(mafragh$env[,1], nb2listw(mafragh$nb))$obs
sum(tests$obs)
}
Run the code above in your browser using DataLab