R/update.xtabs.R

update.xtabs <-
function (object, formula., ..., evaluate = TRUE) 
{
    if (is.null(call<-attr(object, "call"))) 
        stop("need an object with call component")
    extras <- match.call(expand.dots = FALSE)$...
    if (!missing(formula.)) 
        call$formula <- update.formula(call$formula, formula.)
    if (length(extras)) {
        existing <- !is.na(match(names(extras), names(call)))
        for (a in names(extras)[existing]) call[[a]] <- extras[[a]]
        if (any(!existing)) {
            call <- c(as.list(call), extras[!existing])
            call <- as.call(call)
        }
    }
    if (evaluate) 
        eval(call, parent.frame())
    else call
}
friendly/vcdExtra documentation built on Aug. 30, 2023, 6:21 a.m.