# NOT RUN {
w <- unit.square()
xy <- stratrand(w, 10, 10)
# }
# NOT RUN {
plot(w)
points(xy)
# }
# NOT RUN {
# polygonal boundary
bdry <- list(x=c(0.1,0.3,0.7,0.4,0.2),
y=c(0.1,0.1,0.5,0.7,0.3))
w <- owin(c(0,1), c(0,1), poly=bdry)
xy <- stratrand(w, 10, 10, 3)
# }
# NOT RUN {
plot(w)
points(xy)
# }
# NOT RUN {
# determine which grid points are inside polygon
ok <- inside.owin(xy$x, xy$y, w)
# }
# NOT RUN {
plot(w)
points(xy$x[ok], xy$y[ok])
# }
Run the code above in your browser using DataLab