VOOZH about

URL: https://www.geeksforgeeks.org/r-language/calculate-median-of-elements-of-a-vector-in-r-programming-median-function/

⇱ Calculate Median of elements of a Vector in R Programming - median() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Calculate Median of elements of a Vector in R Programming - median() Function

Last Updated : 15 Jul, 2025
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: Output:
[1] 5
[1] -3
Example 2: Output:
[1] NA
[1] 4
Comment

Explore