five_number: Five number summary

Description Usage Arguments Details Value See Also Examples

View source: R/descriptive_statistics.R

Description

Calculates the five number summary of a vector of data or of each column of a matrix of data, using the estimators of the lower quartile, median and upper quartile in the STAT002 notes.

Usage

1
five_number(x, type = 6, na.rm = FALSE)

Arguments

x

A numeric vector or matrix.

type

Argument type used in the call to quantile to estimate the 25%, 50% and 75% quantiles.

na.rm

A logical scalar. If true, any NA and NaNs are removed from x before the sample quantiles are computed.

Details

The five number summary contains the sample minimum and maximum and estimates of the lower quartile, median and upper quartile, i.e. the 25%, 50% and 75% quantiles. These quantiles are estimated using the quantile function. By default, type = 6 is used in the call to quantile in order to use the estimator defined in the STAT002 notes.

Value

A numeric vector (if the input was a vector) or matrix (if the input was a matrix).

See Also

quantile for calculating sample quantiles.

Examples

1
2
3
4
5
6
birth_times <- ox_births[, "time"]
five_number(birth_times)

# Note: summary() uses type = 7 in the call to quantile()
five_number(birth_times, type = 7)
summary(birth_times)

paulnorthrop/stat1004 documentation built on Nov. 17, 2019, 3:49 a.m.