rowCumsums | R Documentation |
Cumulative sums, products, minima and maxima for each row (column) in a matrix.
rowCumsums(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
colCumsums(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
rowCumprods(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
colCumprods(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
rowCummins(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
colCummins(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
rowCummaxs(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
colCummaxs(x, rows = NULL, cols = NULL, dim. = dim(x), ...,
useNames = TRUE)
x |
An NxK |
rows |
A |
cols |
A |
dim. |
An |
... |
Not used. |
useNames |
If |
Returns a numeric
NxK matrix
of the same mode as x
, except when x
is of mode
logical
, then the return type is
integer
.
Henrik Bengtsson
See cumsum
(), cumprod
(),
cummin
(), and cummax
().
x <- matrix(1:12, nrow = 4, ncol = 3)
print(x)
yr <- rowCumsums(x)
print(yr)
yc <- colCumsums(x)
print(yc)
yr <- rowCumprods(x)
print(yr)
yc <- colCumprods(x)
print(yc)
yr <- rowCummaxs(x)
print(yr)
yc <- colCummaxs(x)
print(yc)
yr <- rowCummins(x)
print(yr)
yc <- colCummins(x)
print(yc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.