In R, I have a raster entitled "raster_crude" with the following details:

> raster_crude

class : RasterLayer dimensions : 320, 392, 125440 (nrow, ncol, ncell)
resolution : 0.125, 0.125 (x, y) extent : -152, -103, 30, 70 (xmin, xmax,
ymin, ymax) coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84
+towgs84=0,0,0

In R, I also have a data frame entitled "rangewide_absences" of longitude
and latitude points, within the extent of raster_crude, and with the
following details:

> class(rangewide_absences)[1] "data.frame"
> names(rangewide_absences)[1] "LON" "LAT"
> nrow(rangewide_absences)[1] 217494
> summary(rangewide_absences)
LON              LAT
Min.   :-134.3   Min.   : 0.00 1st Qu.:-120.3   1st Qu.:39.56
Median :-116.0   Median :43.02
Mean   :-115.0   Mean   :42.72 3rd Qu.:-110.5   3rd Qu.:46.27
Max.   :   0.0   Max.   :59.95

Oftentimes, there is more than one point of rangewide_absences falling
within the grid cells of raster_crude. How do I make a new data frame of
points, maintaining the LON and LAT columns, such that only one point is
sampled PER raster grid cell?

I have been using the package "raster." With the function "extract," one
can extract grid cells to points. However, how do you extract a
randomly-selected point relative to each grid cell?

Many thanks,

Jennifer

	[[alternative HTML version deleted]]

