Calculate the Mean of each Row of an Object in R Programming – rowMeans() Function Last Updated : 05 Jun, 2020 Comments Improve Suggest changes Like Article Like Report rowMeans() function in R Language is used to find out the mean of each row of a data frame, matrix, or array. Syntax: rowMeans(data) Parameter: data: data frame, array, or matrix Example 1 Python3 1== # R program to illustrate # rowMean function # Create example values # Set seed set.seed(1234) # Create example data data <- data.frame(matrix(round(runif(12, 2, 20)), nrow = 4, ncol = 3)) # Print data print(rowMeans(data)) Output: [1] 11.666667 12.666667 9.666667 10.333333 Example 2: Python3 1== # R program to illustrate # rowMean function # Create example data with NA data_na <- data.frame(matrix(round(runif(12, 2, 20)), nrow = 4, ncol = 3)) data_na[rbinom(length(data_na), 1, 0.3) == 1] <- NA data_na <- as.data.frame(data_na) print(rowMeans(data_na, na.rm = TRUE)) Output: [1] 3 16 9 3 Comment More infoAdvertise with us Next Article Calculate the Mean of each Row of an Object in R Programming – rowMeans() Function A akhilsharma870 Follow Improve Article Tags : R Language R DataFrame-Function R Math-Function R Vector-Function R Object-Function R Matrix-Function +2 More Similar Reads Get the number of rows of an Object in R Programming - nrow() Function nrow() function in R Language is used to return the number of rows of the specified matrix. Syntax: nrow(x)Parameters: x: matrix, vector, array or data frame  Example 1:  Python3 # R program to illustrate # nrow function # Getting R Biochemical Oxygen Demand Dataset BOD # Calling nrow() function 1 min read Compute the Sum of Rows of a Matrix or Array in R Programming - rowSums Function rowSums() function in R Programming Language is used to compute the sum of rows of a matrix or an array. It simplifies the process of calculating the sum for each row, especially when dealing with large datasets, and can be applied to both numeric and logical data types.Syntax:rowSums(x, na.rm = FAL 3 min read Calculate the Mean of each Column of a Matrix or Array in R Programming - colMeans() Function colMeans() function in R Language is used to compute the mean of each column of a matrix or array. Syntax: colMeans(x, dims = 1) Parameters: x: array of two or more dimensions, containing numeric, complex, integer or logical values, or a numeric data frame dims: integer value, which dimensions are r 2 min read Calculate the Sum of Matrix or Array columns in R Programming - colSums() Function colSums() function in R Language is used to compute the sums of matrix or array columns. Syntax: colSums (x, na.rm = FALSE, dims = 1) Parameters: x: matrix or array dims: this is integer value whose dimensions are regarded as âcolumnsâ to sum over. It is over dimensions 1:dims. Example 1: Python3 # 2 min read Getting a Matrix of number of rows in R Programming - row() Function In this article, we will discuss how to find the number of rows and columns in a matrix in R Programming Language. nrow() Function in Rnrow() function in R Language is used to get the row number of a matrix. Syntax: row(x, as.factor=FALSE) Parameters:x: matrixas.factor: a logical value indicating w 2 min read Like