Learn R Programming

sgsR (version 1.5.0)

extract_metrics: Extract metrics

Description

Extract metric values to existing samples

Usage

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

Value

An sf or data.frame object of samples with metrics attributes.

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.

Author

Tristan R.H. Goodbody

See Also

Other extract functions: extract_strata()

Examples

Run this code
#--- 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
)

Run the code above in your browser using DataLab