[R] Summing over an index of an array

Benilton Carvalho bcarvalh at jhsph.edu
Wed Feb 20 00:43:45 CET 2008


?colSums


On Feb 19, 2008, at 6:39 PM, Saurav Pathak wrote:

> Hi,
>
> I cannot seem to figure out how to sum over an index of a array.
> For example, let A be a 3 dimensional array.  I want to, say, find
> the sum over the first dimension.  That is
>
>        S_jk = Sum_i A_ijk
>
> where now S is a 2-dim matrix.  I dont want to use a loop.
>
> Thanks,
> -- 
> saurav
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list