R colSums Function


colSums() function computes the sums of matrix columns.

colSums (x, na.rm = FALSE, dims = 1)

x: matrix
...

> x <- matrix(rep(1:9),3,3)
> x
     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9

> colSums(x)
[1]  6 15 24