R/utils.R

Defines functions msapply getDistr eq

.eq <-function(x,y = 0*x, tol = 1e-7) abs(x-y)<tol

.getDistr <- function(L2Fam){
        slots <- slotNames(L2Fam@distribution@param)
        slots <- slots[slots != "name"]
        nrvalues <- length(slots)
        if (nrvalues > 0) {
            values <- numeric(nrvalues)
            for (i in 1:nrvalues) 
                values[i] <- attributes(attributes(L2Fam@distribution)$param)[[slots[i]]]

            paramstring <- paste("(", paste(values, collapse = ", "), ")", sep = "")
        }else{
            paramstring <- NULL
        }
        distr <- paste(class(L2Fam@distribution)[1], paramstring, sep = "")
}

.msapply <- function(X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE){
            if(is.null(X)) return(NULL)
            if(is.list(X)) if(is.null(X[[1]])) return(NULL)
            if(length(X)>0) return(sapply(X = X, FUN = FUN, ...,
                                   simplify = simplify, USE.NAMES = USE.NAMES))
            return(NULL)
}

Try the RobAStBase package in your browser

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

RobAStBase documentation built on April 6, 2019, 3 a.m.