Calculate Median of elements of a Vector in R Programming - median() Function Last Updated : 05 Jun, 2020 Comments Improve Suggest changes Like Article Like Report median() function in R Language is used to calculate the median of the elements of the numeric vector passed as argument. Syntax: median(x, na.rm) Parameters: x: Numeric Vector na.rm: Boolean value to ignore NA Example 1: Python3 1== # R program to calculate median of a vector # Creating vector x1 <- c(2, 3, 5, 7, 4, 8, 6) x2 <- c(-3, -5, 6, 2, -4) # Calling median() function median(x1) median(x2) Output: [1] 5 [1] -3 Example 2: Python3 1== # R program to calculate median of a vector # Creating vector x <- c(2, 3, 5, NA, 4, NA, 6) # Calling median() function # with NA values included median(x, na.rm = FALSE) # Calling median() function # with NA values excluded median(x, na.rm = TRUE) Output: [1] NA [1] 4 Comment More infoAdvertise with us Next Article Calculate Median of elements of a Vector in R Programming - median() Function N nidhi_biet Follow Improve Article Tags : R Language R Math-Function R Vector-Function Similar Reads Calculate the Median Absolute Deviation in R Programming - mad() Function The Median Absolute Deviation is calculated in R Language using the mad() function. It is a statistical measurement of a dataset's dispersion or variability. Because it is resistant to outliers and extreme values, the MAD can serve as a robust alternative to standard deviation.The Median Absolute De 2 min read Calculate Arithmetic mean in R Programming - mean() Function 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 v 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 Get the Minimum element of an Object in R Programming - min() Function min() function in R Language is used to find the minimum element present in an object. This object can be a Vector, a list, a matrix, a data frame, etc.. Syntax: min(object, na.rm) Parameters: object: Vector, matrix, list, data frame, etc. na.rm: Boolean value to remove NA element. Example 1: Python 1 min read Like