I would like to take a systematic sample of cells from a raster layer. The raster that I am using to select the sample has been divided into 15 sections. I would like to sample 2 cells from each section, but I would like the relative position of the sampled cells to be the same in each section.
eg. If the cell at the upper right of the first section is selected, I would like to sample the upper right cell of the other 14 sections. But I would like the 'starting place' to be random.
This is what my raster looks like, where the cell value represents what section it belongs to
r<-raster(ncol=36, nrow=35)
r[1:7,1:12]<-1
r[1:7,13:24]<-2
r[1:7,25:36]<-3
r[8:14,1:12]<-4
r[8:14,13:24]<-5
r[8:14,25:36]<-6
r[15:21,1:12]<-7
r[15:21,13:24]<-8
r[15:21,25:36]<-9
r[22:28,1:12]<-10
r[22:28,13:24]<-11
r[22:28,25:36]<-12
r[29:35,1:12]<-13
r[29:35,13:24]<-14
r[29:35,25:36]<-15
plot(r)
How might I do this?