## Load districts of Germany
load(system.file("shapes", "districtsD.RData", package = "surveillance"))
## Determine districts at the border and check the result on the map
if (requireNamespace("sf")) {
atBorder <- polyAtBorder(districtsD, method = "sf")
if (interactive()) plot(districtsD, col = atBorder)
table(atBorder)
}
## For method = "polyclip", a higher snapping tolerance is required
## to obtain the correct result
if (requireNamespace("polyclip")) {
atBorder <- polyAtBorder(districtsD, snap = 1e-6, method = "polyclip")
if (interactive()) plot(districtsD, col = atBorder)
table(atBorder)
}
Run the code above in your browser using DataLab