rep_median_iqr {kdry}R Documentation

rep_median_iqr

Description

Reporting helper function: computes and formats median and interquartile range from a numeric vector.

Usage

rep_median_iqr(
  x,
  digits = 2,
  na.rm = TRUE,
  collapse = "to",
  iqr_brackets = c("round", "square"),
  iqr_prefix = TRUE
)

Arguments

x

A numeric vector.

digits

An integer indicating the number of decimal places.

na.rm

A logical indicating if missings should be removed from x before computing the distributional parameters (default: TRUE).

collapse

A character which is placed between the lower and the upper confidence bound in the formatted output.

iqr_brackets

A character. Either "round" (default) or "square" to indicate the type of brackets to surround the confidence interval in the formatted output.

iqr_prefix

A logical. If TRUE (default), the confidence interval is prefixed with "IQR: ".

Details

This is just a special case of rep_median_ci() with the parameter conf_int set to 50.

Value

A character with the formatted output.

See Also

rep_median_ci()

Examples

set.seed(123)
x <- rnorm(1000)
rep_median_iqr(x)
rep_median_iqr(rep(1, 10))
rep_median_iqr(x, collapse = "-")
rep_median_iqr(x, iqr_brackets = "square")
rep_median_iqr(x, iqr_brackets = "square", iqr_prefix = FALSE)
rep_median_iqr(x, collapse = ";", iqr_prefix = FALSE)


[Package kdry version 0.0.2 Index]