I am trying to aggregate an array based on the dimension name, in an efficient way.
ex_array <- array(1:10000, dim = c(100, 10, 10), dimnames = list(Col1 = c(rep(10,50), rep(20, 50)), Col2 = 1:10, Col3 = 1:10))
No I want to aggregate this array based on the names of the first dimension. This dimension has 2 different names (10 and 20) and therefore the new array should have a dimension of 2 by 10 by 10. All the values with dimension name 1 equal to 10 should be summed and the values with dimension 1 equal to 20 should be summed.
Is there some clever way of doing this?
