Sum of an Array While Keeping its Attributes
This function returns the sum of an numeric array (e.g. vector or matrix) while keeping its attributes.
sumKeepAttr( x, keepNames = FALSE, na.rm = FALSE )
x |
an numeric array (e.g. vector or matrix). |
keepNames |
logical. Should the name(s) of the element(s) of |
na.rm |
logical. Passed to |
the sum (see sum
).
Arne Henningsen
a <- 1:10 attr( a, "min" ) <- 1 attr( a, "max" ) <- 10 sum(a) sumKeepAttr(a)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.