# NOT RUN {
# load sample data (North Carolina SIDS data)
library(spdep)
data("nc.sids")
# calculate the expected numbers of cases
expected <- nc.sids$BIR74 * sum(nc.sids$SID74) / sum(nc.sids$BIR74)
# run FleXScan
fls <- flexscan(x = nc.sids$x, y = nc.sids$y,
observed = nc.sids$SID74,
expected = expected,
name = rownames(nc.sids),
clustersize = 10,
nb = ncCR85.nb)
# Print summary to the terminal
summary(fls)
# Plot graph
plot(fls)
labs <- 1:length(fls$cluster)
legend("topright", legend = labs, col = palette()[labs], lty = 1)
# }
Run the code above in your browser using DataLab