STEM Lessons for College Students

Matrix operations in R

Exploring a matrix’s parameters in r: colSums, rowSums, colMeans, rowMeans, cbind, rbind.

ColSums() returns the sum for each column in your data structure. The only argument you need to pass is your data.
Just as it was with colnames() and rownames(), and cbind() and rbind(), there is a corresponding rowSums() function in R, too. It returns the sum for each row in a matrix.

ColMeans() gives us the means for all columns in our matrix, and rowMeans() returns the averages of the rows in a matrix.

Follow us on YouTube:

Connect with us on our social media platforms:

Prepare yourself for a career in data science with our comprehensive program:

Get in touch about the training at:

Comment, like, share, and subscribe! We will be happy to hear from you and will get back to you!

%d bloggers like this: