## generates a random sample of points
xy <- matrix(runif(1000), ncol=2)
## coerce them to SpatialPoints
xy <- SpatialPoints(xy)
plot(xy)
## generate a SpatialPixelsDataFrame
## (and count the number of points)
spd <- ascgen(xy, cellsize=0.1)
image(spd)
Run the code above in your browser using DataLab