# Generate example coordinates
set.seed(42)
coords <- cbind(x = runif(100), y = runif(100))
rownames(coords) <- paste0("spot_", 1:100)
# \donttest{
# Build network using Delaunay (requires geometry package)
if (requireNamespace("geometry", quietly = TRUE)) {
W_delaunay <- buildSpatialNetwork(coords, method = "delaunay")
}
# Build network using KNN (requires RANN package)
if (requireNamespace("RANN", quietly = TRUE)) {
W_knn <- buildSpatialNetwork(coords, method = "knn", k = 6)
}
# }
Run the code above in your browser using DataLab