Displaying 1 result from an estimated 1 matches for "sdum".
Did you mean:
sdm
2005 Jan 14
3
summing subsets of rows matrices
...(bin). Is there an efficient way to do this in R without using loops. Looping takes forever to perform this task!
For example suppose we have the matrix
> matrix(1:12,6,2)
[,1] [,2]
[1,] 1 7
[2,] 2 8
[3,] 3 9
[4,] 4 10
[5,] 5 11
[6,] 6 12
my problem is to sdum for example:
1. the first and second row
2. the third and fourth
and
3. the fifth and the sixth.
To obtain
[,1] [,2]
[1,] 3 15
[2,] 7 19
[3,] 11 23
Thank you.
[[alternative HTML version deleted]]