median2: Median (Q 50)

View source: R/stats.R

median2R Documentation

Median (Q 50)

Description

Median as the 50th quantile with an option to select quantile algorithm

Usage

median2(x, type = 7, na.rm = FALSE)

q50(x, type = 7, na.rm = FALSE)

Arguments

x

numeric vector whose sample quantiles are wanted, or an object of a class for which a method has been defined (see also ‘details’). NA and NaN values are not allowed in numeric vectors unless na.rm is TRUE.

type

an integer between 1 and 9 selecting one of the nine quantile algorithms detailed below to be used.

na.rm

logical; if true, any NA and NaN's are removed from x before the quantiles are computed.

Details

q50 is an alias for median2

Value

See stats::quantile()

See Also

stats::quantile()

Examples

set.seed(42)
x <- rnorm(100)
median(x)            # 0.08979677
median2(x, type = 7) # 0.08979677 - default type is 7
median2(x, type = 3) # 0.08976065


mark documentation built on Oct. 23, 2023, 9:06 a.m.