Skip to contents

Thin extender over gstat::variogram that computes the sample (semi-)variogram of a spatially-indexed response for use in kriging and other geostatistical workflows.

Usage

morie_geostat_variogram(formula, data, ...)

Arguments

formula

A formula describing the response and any trend terms (e.g. z ~ 1 for an intercept-only model), as expected by gstat::variogram.

data

A spatial object (e.g. sp::SpatialPointsDataFrame or sf object) or data frame with coordinates available that gstat::variogram can consume.

...

Further arguments forwarded to gstat::variogram (e.g. cutoff, width, cressie, cloud).

Value

A list with $method = "gstat::variogram" and $raw (a gstatVariogram data frame with the binned distances and semivariance estimates).

Examples

if (FALSE) { # \dontrun{
  if (requireNamespace("gstat", quietly = TRUE) &&
      requireNamespace("sp", quietly = TRUE)) {
    data(meuse, package = "sp")
    sp::coordinates(meuse) <- ~ x + y
    morie_geostat_variogram(log(zinc) ~ 1, data = meuse)
  }
} # }