search for: decompactify

Displaying 1 result from an estimated 1 matches for "decompactify".

Did you mean: compactify
2006 Jun 09
1
Idempotent apply
...lt;- function(x, margins=1, fun, ..., REDUCE=TRUE) { if (!is.array(x)) x <- as.array(x) reorder <- c(margins, (1:length(dim(x)))[-margins]) x <- aperm(x, (reorder)) x <- compactify(x, length(margins)) results <- lapply(x, fun, ...) dim(results) <- dim(x) results <- decompactify(results) if (REDUCE) reduce(results) else results } vdim <- function(x) if (is.vector(x)) length(x) else dim(x) # Compacts an array into a smaller array of lists containing the remaining dimensions compactify <- function(x, dims = 1) { d <- dim(x) ds <- seq(along=d) margins <-...