sample_sys_strat {sgsR} | R Documentation |
Systematic stratified sampling
Description
Systematic stratified sampling with random start point and translation within a square or hexagonal tessellation for each stratum.
Usage
sample_sys_strat(
sraster,
cellsize,
square = TRUE,
location = "centers",
force = FALSE,
access = NULL,
buff_inner = NULL,
buff_outer = NULL,
plot = FALSE,
filename = NULL,
overwrite = FALSE,
details = FALSE
)
Arguments
sraster |
spatRaster. Stratified raster with name |
cellsize |
Numeric. Desired cellsize for tessellation. |
square |
Logical. Tessellation shape. Default is regular square grid,
if |
location |
Character. Sample location within tessellation. |
force |
Logical. Only applies when |
access |
sf. Road access network - must be lines. |
buff_inner |
Numeric. Inner buffer boundary specifying distance from access where plots cannot be sampled. |
buff_outer |
Numeric. Outer buffer boundary specifying distance from access where plots can be sampled. |
plot |
Logical. Plots output strata raster with samples. |
filename |
Character. Path to write output samples. |
overwrite |
Logical. Choice to overwrite existing |
details |
Logical. If |
Value
An sf object with sampled points over unique tessellations.
Note
Specifying location = "random"
can result in tessellations with no samples.
This results from raster
have NA
values at the random location chosen.
Using force = TRUE
removes areas of NA
from sampling entirely, but
considerably slows processing speeds. Thanks to R. Hijmans for help in debugging and
providing suggestions for this script.
All stratum are sampled using random tessellation start points and translations.
Author(s)
Tristan R.H. Goodbody
See Also
Other sample functions:
sample_ahels()
,
sample_balanced()
,
sample_clhs()
,
sample_existing()
,
sample_nc()
,
sample_srs()
,
sample_strat()
,
sample_systematic()
Examples
#--- Load raster and access files ---#
r <- system.file("extdata", "sraster.tif", package = "sgsR")
sr <- terra::rast(r)
#--- perform grid sampling ---#
sample_sys_strat(
sraster = sr,
cellsize = 1000
)
sample_sys_strat(
sraster = sr,
cellsize = 1000,
square = FALSE,
location = "corners"
)