K handles the general case:
1 1 1 + 2 2 2
3 3 3
(1 1 1; 2 2 2; 3 3 3) + (4 4 4; 5 5 5; 6 6 6)
(5 5 5
7 7 7
9 9 9) 1 1 1 + 2 2 2
3 3 3
(1 1 1; 2 2 2; 3 3 3) + (4 4 4; 5 5 5; 6 6 6)
(5 5 5
7 7 7
9 9 9) > c(1, 1, 1) + c(2, 2, 2)
[1] 3 3 3
> matrix(c(1, 1, 1, 2, 2, 2, 3, 3, 3),
+ ncol = 3, byrow = TRUE) +
+ matrix(c(4, 4, 4, 5, 5, 5, 6, 6, 6),
+ ncol = 3, byrow = TRUE)
[,1] [,2] [,3]
[1,] 5 5 5
[2,] 7 7 7
[3,] 9 9 9
Not quite so concise and elegant but it's pretty straightforward stuff for most R users.