extract_metrics {sgsR}R Documentation

Extract metrics

Description

Extract metric values to existing samples

Usage

extract_metrics(
  mraster,
  existing,
  quiet = FALSE,
  data.frame = FALSE,
  filename = NULL,
  overwrite = FALSE
)

Arguments

mraster

spatRaster. Metrics 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 metrics attributes.

Note

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

Author(s)

Tristan R.H. Goodbody

See Also

Other extract functions: extract_strata()

Examples

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

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

extract_metrics(
  mraster = mr,
  existing = e
)


[Package sgsR version 1.4.5 Index]