R/SAP.R

Defines functions SAP

Documented in SAP

SAP <-
function(..., nseg = c(10, 10), pord = c(2,2), degree = c(3,3), nest.div = c(1,1), ANOVA = FALSE, center = FALSE) {
    args <- match.call()
    vars <- as.list(substitute(list(...)))[-1]
    if(length(vars) != 2) 
        stop("Error in the specification of the spatial effect: both spatial coordinates must be indicated")

    x.coord = vars[[1]]
    y.coord = vars[[2]]
 
    res <- list()
    res$x.coord <- deparse(x.coord, backtick = TRUE, width.cutoff = 500)
    res$y.coord <- deparse(y.coord, backtick = TRUE, width.cutoff = 500)
    res$nseg = if(length(nseg) == 1) rep(nseg, 2) else nseg
    res$pord = if(length(pord) == 1) rep(pord, 2) else pord
    res$degree = if(length(degree) == 1) rep(degree, 2) else degree
    res$nest.div = if(length(nest.div) == 1) rep(nest.div, 2) else nest.div
    res$center <- center
    res$type <- if(ANOVA) "SAP.ANOVA" else "SAP"
    
    res 
}

Try the SpATS package in your browser

Any scripts or data that you put into this service are public.

SpATS documentation built on Nov. 10, 2022, 5:58 p.m.