R/listOperations.R

Defines functions outerList zipLists

Documented in outerList zipLists

outerList <- function(X, Y, FUN, ...) {
    nX <- length(X)
    nY <- length(Y)
    
    x <- rep(X, nY)
    y <- rep(Y, each = nX)
    
    res <- mapply(FUN, x, y, ...)
    
    matrix(res, nrow = nX, dimnames = list(names(X), names(Y)))
}

zipLists <- function(...)
    mapply(function(...) list(...), ..., SIMPLIFY = FALSE)

Try the rmngb package in your browser

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

rmngb documentation built on May 29, 2017, 9:22 p.m.