R/colMeans-method.R

#' @importFrom methods new
#' @exportMethod colMeans
setMethod("colMeans",
  signature(x = "magpie"),
  function(x, na.rm = FALSE, dims = 1, ...) { #nolint
    xGlo <- colMeans(as.array(x), na.rm = na.rm, ...)
    out <- new("magpie", array(xGlo, dim = c(1, dim(xGlo)), dimnames = c("GLO", dimnames(xGlo))))
    return(out)
  }
)

Try the magclass package in your browser

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

magclass documentation built on July 9, 2023, 7:03 p.m.