R/utils.R

Defines functions foreachCleanup closeSockets greaterOrEqual

greaterOrEqual <- function(x,y) {
    precision <- sqrt(.Machine$double.eps)
    (x >= y) | (abs(x-y) <= precision)
}

closeSockets <- function() {
    allCon <- showConnections()
    socketCon <- as.integer(rownames(allCon)[allCon[, "class"] == "sockconn"])
    sapply(socketCon, function(ii) close.connection(getConnection(ii)) )
}

foreachCleanup <- function() {
    if (exists(".revoDoParCluster", where=doParallel:::.options)) {
        if(!is.null(doParallel:::.options$.revoDoParCluster))
            stopCluster(doParallel:::.options$.revoDoParCluster)
        remove(".revoDoParCluster", envir=doParallel:::.options)
    }
}

Try the bumphunter package in your browser

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

bumphunter documentation built on Nov. 8, 2020, 4:59 p.m.