Calculate Arithmetic mean in R Programming - mean() Function Last Updated : 05 Jun, 2020 Comments Improve Suggest changes Like Article Like Report mean() function in R Language is used to calculate the arithmetic mean of the elements of the numeric vector passed to it as argument. Syntax: mean(x, na.rm) Parameters: x: Numeric Vector na.rm: Boolean value to ignore NA value Example 1: Python3 1== # R program to calculate # Arithmetic mean of a vector # Creating a numeric vector x1 <- c(1, 2, 3, 4, 5, 6) x2 <-c(1.2, 2.3, 3.4, 4.5) x3 <- c(-1, -2, -3, -4, -5, -6) # Calling mean() function mean(x1) mean(x2) mean(x3) Output: [1] 3.5 [1] 2.85 [1] -3.5 Example 2: Python3 1== # R program to calculate # Arithmetic mean of a vector # Creating a numeric vector x1 <- c(1, 2, 3, NA, 5, NA, NA) # Calling mean() function # including NA values mean(x1, na.rm = FALSE) # Calling mean() function # excluding NA values mean(x1, na.rm = TRUE) Output: [1] NA [1] 2.75 Comment More infoAdvertise with us Next Article Calculate Arithmetic mean in R Programming - mean() Function N nidhi_biet Follow Improve Article Tags : R Language R Math-Function Similar Reads Calculate the Weighted Mean in R Programming - weighted.mean() Function weighted.mean() function in R Language is used to compute the weighted arithmetic mean of input vector values. Syntax: weighted.mean(x, weights) Parameters: x: data input vector weights: It is weight of input data. Returns: weighted mean of given values Example 1: r # Create example data x1 <- c( 1 min read Calculate the Mean of each Row of an Object in R Programming â rowMeans() Function 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) # Cr 1 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 Mean, Median and Mode in R Programming Statistical measures like mean, median, and mode are important for summarizing and understanding the central tendency of a dataset. In R, these measures can be calculated easily using built-in functions. This article will provide a comprehensive guide on how to calculate mean, median and mode in R P 2 min read Comparing Means in R Programming There are many cases in data analysis where youâll want to compare means for two populations or samples and which technique you should use depends on what type of data you have and how that data is grouped together. The comparison of means tests helps to determine if your groups have similar means. 14 min read Like