sample.poly

0th

Percentile

Sample Polygons

Creates an equal sample of n for each polygon in an sp Polygon class object

Usage
sample.poly(x, n = 10, type = "random", ...)
Arguments
x

sp class SpatialPolygons or SpatialPolygonsDataFrame object

n

Number of random samples

type

Type of sample with options for: "random", "regular", "stratified", "nonaligned", "hexagonal", "clustered", "Fibonacci". See "spsample" for details.

...

Additional arguments passed to spsample

Value

sp SpatialPointsDataFrame object

Aliases
  • sample.poly
Examples
# NOT RUN {
 library(raster)
 library(sp)   
   p <- raster(nrow=10, ncol=10)
   p[] <- runif(ncell(p)) * 10
   p <- rasterToPolygons(p, fun=function(x){x > 9})   
   s <- sample.poly(p, n = 5, type = "random")
     plot(p)
       plot(s, pch = 20, add = TRUE)
       box()
       title("Random sample (n=5) for each polygon")	   

# }
Documentation reproduced from package spatialEco, version 1.3-2, License: GPL-3

Community examples

Looks like there are no examples yet.