R/means_along.R

means_along <- function(a, i) {
  n <- length(dim(a))
  b <- aperm(a, c(seq_len(n)[-i], i))
  rowMeans(b, dims = n - 1, na.rm = T)
}
matteodefelice/eneaR documentation built on May 21, 2019, 12:59 p.m.