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