median {math} | R Documentation |
Compute the sample median.
median(x,
na.rm = FALSE);
This is a generic function for which methods can be written. However, the default method makes use of is.na, sort and mean from package base all of which are generic, and so the default method will work for most classes (e.g., "Date") for which a median is a reasonable concept.
The default method returns a length-one object of the same type as x, except when x is logical or integer of even length, when the result will be double. If there are no values Or If na.rm = False And there are NA values the result Is NA Of the same type As x (Or more generally the result Of x[FALSE][NA]).