4 ms·
As does R :) > 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,
by hazexp 15y ago
As does R :)
> 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.