R/colMeans-method.R

#' @importFrom methods new
#' @exportMethod colMeans
setMethod("colMeans",
  signature(x = "magpie"),
  function(x, na.rm = FALSE, dims = 1, ...) { # nolint: object_name_linter.
    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 June 29, 2026, 5:06 p.m.