# NOT RUN {
plot_path <- function(x, y, ...) {
plot.new()
plot.window(range(x, na.rm = TRUE), range(y, na.rm = TRUE))
polypath(x, y, ...)
}
x <- c(5, 10, 10, 5, 5, 6, 6, 7, 7, 6, 8, 8, 9, 9, 8)
y <- c(5, 5, 10, 10, 5, 6, 7, 7, 6, 6, 8, 9, 9, 8, 8)
plot_path(x, y, col = "grey", border = NA)
points(poi(x, y))
# }
# NOT RUN {
# Find visual centers for North Carolina counties
library(sf)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
locations = do.call(rbind, poi(nc, precision=0.01))
plot(st_geometry(nc))
points(locations)
# }
Run the code above in your browser using DataLab