median_iqr {qwraps2} | R Documentation |
Median and Inner Quartile Range
Description
A function for calculating and formatting the median and inner quartile range of a data vector.
Usage
median_iqr(
x,
digits = getOption("qwraps2_frmt_digits", 2),
na_rm = FALSE,
show_n = "ifNA",
markup = getOption("qwraps2_markup", "latex"),
...
)
Arguments
x |
a numeric vector |
digits |
digits to the right of the decimal point to return. |
na_rm |
if true, omit NA values |
show_n |
defaults to "ifNA". Other options are "always" or "never". |
markup |
latex or markdown |
... |
pass through |
Details
Given a numeric vector, median_iqr
will return a character string with
the median and IQR. Formatting of the output will be extended in
future versions.
Value
a character vector of the formatted values
Examples
set.seed(42)
x <- rnorm(1000, 3, 4)
median(x)
quantile(x, probs = c(1, 3)/4)
median_iqr(x)
median_iqr(x, show_n = "always")
x[187] <- NA
# median_iqr(x) ## Will error
median_iqr(x, na_rm = TRUE)
[Package qwraps2 version 0.6.0 Index]