# NOT RUN {
library(sp)
data(edgeroi)
profs <- edgeroi[["sites"]]
coordinates(profs) <- ~ LONGDA94 + LATGDA94
proj4string(profs) <- CRS("+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs")
## sample SpatialPointsDataFrame:
prof1 <- sample.grid(profs, cell.size = c(0.02,0.02), n = 1)
l0 <- list("sp.points", profs, pch=1, col="red")
l1 <- list("sp.points", prof1$subset, pch="+", col="black", cex=1.2)
spplot(prof1$grid, scales=list(draw=TRUE),
col.regions="grey", sp.layout=list(l0, l1))
## Subsampling ratio in percent:
round(length(prof1$subset)/length(profs)*100, 1)
# }
Run the code above in your browser using DataLab