1combine <- function(x, value, protect, ...) stop("combine() depricated due to naming conflict renamed consolidate()") 2'combine<-' <- function(x, protect, ..., value) stop("combine<-() depricated due to naming conflict renamed consolidate<-()") 3 4consolidate <- function(x, value, protect, ...) { 5 UseMethod("consolidate") 6} 7 8'consolidate<-' <- function(x, protect, ..., value) 9 eval.parent(replace(match.call(expand.dots=FALSE), list=1, 10 values=list(as.name("consolidate")))) 11 12consolidate.default <- function(x, value, protect=FALSE, ...) { 13 if(missing(x) || is.null(x)) 14 x <- vector() 15 16 if(missing(value) || is.null(value)) 17 value <- vector() 18 19 xNames <- names(x) 20 valueNames <- names(value) 21 22 if(is.null(xNames) || is.null(valueNames) || all(valueNames == "") || 23 all(xNames == "")) 24 return(c(x, value)) 25 26 vars <- intersect(xNames, valueNames[valueNames != ""]) 27 if(!protect) 28 x[vars] <- value[vars] 29 30 c(x, value[!valueNames %in% vars]) 31} 32 33