Learn R Programming

mark (version 0.8.2)

median2: 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)

Value

See stats::quantile()

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

See Also

Examples

Run this code
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

Run the code above in your browser using DataLab