Last chance! 50% off unlimited learning
Sale ends in
median(x, na.rm = FALSE, …)
NA
values should be stripped before the computation proceeds.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]
).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.quantile
for general quantiles.median(1:4) # = 2.5 [even number]
median(c(1:3, 100, 1000)) # = 3 [odd, robust]
Run the code above in your browser using DataLab