Skip to content

function sum for array

2 messages · Simone Salvadei, R. Michael Weylandt

#
It might not be as general as you have in mind, but this works:

X = array(1:24, c(2,3,4))
rowSums(X, dims = 2)

Combined with aperm() it's pretty powerful.

Michael


On Thu, Nov 17, 2011 at 11:24 AM, Simone Salvadei
<simone.salvadei at gmail.com> wrote: