extract_strata {sgsR}R Documentation

Extract strata

Description

Extract stratum values to existing samples

Usage

extract_strata(
  sraster,
  existing,
  quiet = FALSE,
  data.frame = FALSE,
  filename = NULL,
  overwrite = FALSE
)

Arguments

sraster

spatRaster. Stratification raster.

existing

sf 'POINT'. Existing plot network.

quiet

Logical. If TRUE the user will not get messages about samples with NA values.

data.frame

Logical. Output as data.frame if TRUE

filename

Character. Path to write output samples.

overwrite

Logical. Choice to overwrite existing filename if it exists.

Value

An sf or data.frame object of samples with strata attribute.

Note

If data.frame = TRUE output will be written using write.table

Author(s)

Tristan R.H. Goodbody

See Also

Other extract functions: extract_metrics()

Examples

#--- Load sraster ---#
r <- system.file("extdata", "sraster.tif", package = "sgsR")
sr <- terra::rast(r)

#--- load existing samples ---#
e <- system.file("extdata", "existing.shp", package = "sgsR")
e <- sf::st_read(e)

extract_strata(
  sraster = sr,
  existing = e
)


[Package sgsR version 1.4.5 Index]