sample_balanced {sgsR}R Documentation

Balanced sampling

Description

Balanced raster sampling using lcube and lpm2_kdtree methods

Usage

sample_balanced(
  mraster,
  nSamp,
  algorithm = "lpm2_kdtree",
  p = NULL,
  access = NULL,
  buff_inner = NULL,
  buff_outer = NULL,
  plot = FALSE,
  filename = NULL,
  overwrite = FALSE
)

Arguments

mraster

spatRaster. ALS metrics raster.

nSamp

Numeric. Number of desired samples.

algorithm

Character. One of lpm2_kdtree, lcube, lcubestratified.

p

Numeric. Vector with length equal to the number of cells in mraster representing the inclusion probability for each candidate sample. Default = nSamp / N, where N is the number of cells.

access

sf 'LINESTRING' or 'MULTILINESTRING'. Access network.

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 and visualized strata with boundary dividers.

filename

Character. Path to write stratified raster to disc.

overwrite

Logical. Specify whether filename should be overwritten on disc.

Value

An sf object with nSamp samples.

Author(s)

Tristan R.H. Goodbody

References

Anton Grafström and Jonathan Lisic (2019). BalancedSampling: Balanced and Spatially Balanced Sampling. R package version 1.5.5. https://CRAN.R-project.org/package=BalancedSampling

Jonathan Lisic and Anton Grafström (2018). SamplingBigData: Sampling Methods for Big Data. R package version 1.0.0. https://CRAN.R-project.org/package=SamplingBigData

Grafström, A. Lisic, J (2018). BalancedSampling: Balanced and Spatially Balanced Sampling. R package version 1.5.4. http://www.antongrafstrom.se/balancedsampling

See Also

Other sample functions: sample_ahels(), sample_clhs(), sample_existing(), sample_nc(), sample_srs(), sample_strat(), sample_sys_strat(), sample_systematic()

Examples

#--- Load raster and existing plots---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
mr <- terra::rast(r)

sample_balanced(
  mraster = mr,
  nSamp = 200
)


[Package sgsR version 1.4.5 Index]