r sum matrix by row code example
Example: how to get sum of rows and columns of a matrix in R
#Suppose x is a matrix
x<-matrix()
#Vector of Row sums of x
rowSums(x)
#Vector of Col sums of x
colSums(x)
#Suppose x is a matrix
x<-matrix()
#Vector of Row sums of x
rowSums(x)
#Vector of Col sums of x
colSums(x)