# Draw a spatially balanced sample of n = 25 from a Halton Frame over Gates --
# Use the North Carolina shapefile supplied in the sf R package.
shp_file <- sf::st_read(system.file("shape/nc.shp", package="sf"))
shp_gates <- shp_file[shp_file$NAME == "Gates",]
# Vertically aligned master sample bounding box.
bb <- spbal::BoundingBox(shapefile = shp_gates)
set.seed(511)
result7 <- spbal::HaltonFrame(shapefile = shp_gates,
J = c(6, 4),
boundingbox = bb)
Frame <- result7$hf.pts.shp
# Get the first 25 sites from a B = (2^6) * (3^4) Halton Frame (62,208 grid
# points covering Gates).
n_samples <- 25
FrameSample <-getSample(shapefile = Frame,
n = n_samples)
FrameSample <- FrameSample$sample
FrameSample
Run the code above in your browser using DataLab