Skip to content
Prev 273447 / 398506 Next

mean of 3D arrays

As promised

### Untested
pmean <- function(...){
    dotArgs <- list(...)
    l <- length(dotArgs)
    if( l == 0L ) stop("no arguments")
    temp <- dotArgs[[1]]
    if ( l > 1L ) {for(i in 2L:l) {temp <- temp + dotArgs[[i]]}}
    temp/l
}

Clunky but gets the job done. Its still too early for me to think straight so I'll let someone else kill the loop and add error checking if interested. 

Michael Weylandt
On Oct 5, 2011, at 9:14 AM, "R. Michael Weylandt <michael.weylandt at gmail.com>" <michael.weylandt at gmail.com> wrote: