On Nov 26, 2011, at 11:24 AM, David Winsemius wrote:
On Nov 26, 2011, at 9:32 AM, zloncaric wrote:
Hello!
Is it posible to apply /cumsum()/ along the 3rd dimension of 3D
array?
Something like matrlab function - /cumsum (*A*,dim)/ which returns
the
cumulative sum of the elements along the dimension of *A* specified
by
scalar dim.
`apply` lets you chose which dimension gets selected.
Perhaps:
apply(mat, 3, cumsum)
Or perhaps
apply(mat, 1:2, cumsum)
(This is pretty basic stuff so you should probably be reading or at
least skimming somewhat more thoroughly than you have so far the
Introduction to R document and there is also the R for Matlab
document by Bob Muenchen ... and a compendium of equivalencies by
Hiebeler at: www.math.umaine.edu/~hiebeler/comp/matlabR.html )
--
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.