rowSums (x, ...)
rowMeans(x, ...)
## S3 method for class 'default':
rowSums(x, na.rm = FALSE, dims = 1, \dots)
## S3 method for class 'default':
rowMeans(x, na.rm = FALSE, dims = 1, \dots)
## S3 method for class 'tis':
rowSums(x, \dots)
## S3 method for class 'tis':
rowMeans(x, \dots)tis time indexed seriesrowSums.default or
rowMeans.default, which are actually the versions of
rowSums and rowMeans from the base
package. The ...argument is ignored in rowSums.dNaN)
be omitted from the calculations?row*, the sum or mean is
over dimensions dims+1, ...; for col* it is over
dimensions 1:dimsdimnames (or names for a vector
result) are taken from the original array. If there are no values in a range to be summed over (after removing
missing values with na.rm = TRUE), that
component of the output is set to 0 (rowSums) or NA
(rowMeans), consistent with sum and
mean.
The tis-specific methods also return a tis.
apply with
FUN = mean or FUN = sum with appropriate margins, but
are a lot faster. As they are written for speed, they blur over some
of the subtleties of NaN and NA.
If na.rm = FALSE and either NaN or NA appears in
a sum, the result will be one of NaN or NA, but which
might be platform-dependent.apply, rowsum, and colSums
for more details and examples.mat <- tis(matrix(1:36, ncol = 3), start = latestJanuary())
cbind(mat, rowSums(mat), rowMeans(mat))Run the code above in your browser using DataLab