https://github.com/cran/gstat
Raw File
Tip revision: 896cd35f91880f970197d8575a84bd016331ab6f authored by Edzer J. Pebesma on 11 April 2008, 00:00:00 UTC
version 0.9-46
Tip revision: 896cd35
gstat.formula.R
# $Id: gstat.formula.q,v 1.8 2007-06-08 06:45:52 edzer Exp $

"gstat.formula" <-
function (formula, data)
{
    m = model.frame(terms(formula), as(data, "data.frame"))
    Y = model.extract(m, "response")
    if (length(Y) == 0)
        stop("no response variable present in formula")
    Terms = attr(m, "terms")
    X = model.matrix(Terms, m)
    has.intercept = attr(Terms, "intercept")

	if (gridded(data))
		grid = gridparameters(data)
	else
		grid = numeric(0)

    list(y = Y, locations = coordinates(data), X = X, call = call,
        has.intercept = has.intercept, grid = as.double(unlist(grid)))
}
back to top