magclass (version 4.107.0)

dimSums: Summation over dimensions

Description

This function sums over any dimension of a magpie object or an array

Usage

dimSums(x, na.rm = FALSE, dims = NULL, dim = 3, sep = ".", ...)

Arguments

x

A MAgPIE-object or an array

na.rm

logical. Should missing values (including NaN) be omitted from the calculations?

dims

Depreceated version of argument dim. Please use dim instead (it is just it there for back compatibility and will be removed soon.)

dim

The dimensions(s) to sum over. A vector of integers or characters (dimension names). If the MAgPIE object has more than 1 actual dimension collected in the third real dimension, each actual dimension can be summed over using the corresponding dim code (see dimCode for more information)

sep

A character separating joined dimension names

...

Further arguments passed to rowSums internally

Value

value

A MAgPIE object or an array (depending on the format of x) with values summed over the specified dimensions

See Also

rowSums, dimSums, dimCode

Examples

Run this code
# NOT RUN {
  test<-as.magpie(array(1:4,dim=c(2,2)))
  dimSums(test,dim=c(1,3))
  dimSums(test[,,1],na.rm=TRUE,dim=c(1,2))
  

# }

Run the code above in your browser using DataCamp Workspace