Takes a set of points, a buffer radius, a sample size, and a mask and returns randomly sampled points from within that buffer radius. Code modified from Elith and Hijmans SDM with R tutorial
background.points.buffer(points, radius, n, mask)A two column data frame with X and Y coordinates
Radius for circular buffers to draw around points, in meters.
Sample size for number of background points to return
A raster to use as a mask for drawing points
A data frame of points drawn at random from circular buffers around the occurrence points.