https://github.com/cran/gstat
Tip revision: bb7c67ff9d4495b607d15ae6e52e18b7796d7c35 authored by Edzer Pebesma on 19 October 2022, 08:45:08 UTC
version 2.1-0
version 2.1-0
Tip revision: bb7c67f
variogram.formula.R
# $Id: variogram.formula.q,v 1.8 2006-02-10 19:01:07 edzer Exp $
"variogram.formula" <-
function (object, locations = coordinates(data), data, ...)
{
if ((missing(locations) && inherits(data, "sf")) || (inherits(locations, "sf"))) {
if (!requireNamespace("sf", quietly = TRUE))
stop("sf required: install that first") # nocov
if (missing(locations))
data = as(data, "Spatial")
else
locations = as(locations, "Spatial")
}
# gstat.formula takes care of the case where locations contains
# both data and coordinates --- see there.
## ret = gstat.formula(object, locations, data)
## variogram(object = ret$y, locations = ret$locations, X = ret$X, ...)
if ((missing(locations) && is(data, "ST")) || (is(locations, "ST")))
variogramST(formula = object, locations = locations, data = data, ...)
else {
g = gstat(formula = object, locations = locations, data = data)
variogram(g, ...)
}
}