Learn R Programming

spatialEco (version 2.0-1)

parea.sample: Percent area sample

Description

Creates a point sample of polygons where n is based on percent area

Usage

parea.sample(x, pct = 0.1, join = FALSE, sf = 4046.86, stype = "random", ...)

Value

An sf POINT object

Arguments

x

An sf POLYGON object

pct

Percent of area sampled

join

FALSE/TRUE Join polygon attributed to point sample

sf

Scaling factor (default is meters to acres conversion factor)

stype

Sampling type ('random', 'regular', 'nonaligned', 'hexagonal')

...

Additional arguments passed to spsample

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

Run this code
if(require(sf, quietly = TRUE)) {
  nc <- st_read(system.file("shape/nc.shp", package="sf"))
    nc <- suppressWarnings(st_cast(nc[c(10,100),], "POLYGON"))
  
  ( ars <- parea.sample(nc, pct=0.001, join = TRUE, stype='random') ) 
    plot(st_geometry(nc))
      plot(st_geometry(ars), pch=19, add=TRUE)  
}

Run the code above in your browser using DataLab