how to add sum of every row in r 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)