I do some work where I need to create as a) random spatial points; b) nonrandom spatial points over a polygon, i.e. for b) the probability of points depends, for example, on the east-west gradient or on the distance from some point source or something else
For a) I can generate random points over the polygon using the command spsample()in the package spas follows:
library(maptools)
nc <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], proj4string=CRS("+proj=longlat +datum=NAD27"))
plot(nc)
library(sp)
pts <- spsample(nc, 100, type="random")
plot(nc)
points(pts, pch=19, col="red")
This gives exactly what I want for a). But can this be changed for b), so that points are more likely in the East than the West, for example? (and while you can still indicate that I want 100 points?)