Re: [R-sig-Geo] stratified random sampling

2009-02-26 Thread Roger Bivand
On Wed, 25 Feb 2009, Roger Bivand wrote: On Tue, 24 Feb 2009, Heuvelink, Gerard wrote: Dear list, The stratified random sampling problem that I submitted a few days ago has already been solved, with the help of several of you, notably Edzer Pebesma. Edzer came up with the following solution

Re: [R-sig-Geo] stratified random sampling

2009-02-25 Thread Dylan Beaudette
On Wed, Feb 25, 2009 at 12:53 AM, Roger Bivand wrote: > On Tue, 24 Feb 2009, Heuvelink, Gerard wrote: > >> Dear list, >> >> The stratified random sampling problem that I submitted a few days ago has >> already been solved, with the help of several of you, notably Edzer Pebesma. >> Edzer came up wi

Re: [R-sig-Geo] stratified random sampling

2009-02-25 Thread Roger Bivand
On Tue, 24 Feb 2009, Heuvelink, Gerard wrote: Dear list, The stratified random sampling problem that I submitted a few days ago has already been solved, with the help of several of you, notably Edzer Pebesma. Edzer came up with the following solution: WARNING!! This is only conditionally co

[R-sig-Geo] stratified random sampling

2009-02-24 Thread Heuvelink, Gerard
Dear list, The stratified random sampling problem that I submitted a few days ago has already been solved, with the help of several of you, notably Edzer Pebesma. Edzer came up with the following solution: library(sp) library(rgdal) nc1 <- readShapePoly(system.file("shapes/sids.shp",package="

Re: [R-sig-Geo] stratified random sampling

2009-02-23 Thread Edzer Pebesma
Hi Gerard, following Dylan's hint, the following example should be easily reproducable: library(maptools) nc1 <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], proj4string=CRS("+proj=longlat +datum=NAD27")) x100 = do.call(rbind, sapply(slot(nc1, "polygons"), spsample, n=1, t

Re: [R-sig-Geo] stratified random sampling

2009-02-23 Thread rick reeves
Hi Gerald: I have an example that may help: It demonstrates the sampling of a polygon shape file with a regularly-spaced point grid, and assignment of polygon values to the sampling points: http://nceas.ucsb.edu/scicomp/GISSeminar/UseCases/SampleVectorPolygonsRasterGrid/SampleVectorPolysRastGr

Re: [R-sig-Geo] stratified random sampling

2009-02-23 Thread Dylan Beaudette
On Monday 23 February 2009, Heuvelink, Gerard wrote: > Dear list, > > I use readShapePoly to import a shape file. The file has multiple polygons > (actually, a 'polygon' may consist of multiple polygons that have the same > ID). I want to sample one location at random from each of the polygons. I >

[R-sig-Geo] stratified random sampling

2009-02-23 Thread Heuvelink, Gerard
Dear list, I use readShapePoly to import a shape file. The file has multiple polygons (actually, a 'polygon' may consist of multiple polygons that have the same ID). I want to sample one location at random from each of the polygons. I tried to do this with spsample but did not manage (the opti