median_quart: Compute median and quartiles and put together.

View source: R/descriptives.R

median_quartR Documentation

Compute median and quartiles and put together.

Description

Compute median and quartiles and put together.

Usage

median_quart(
  x,
  nround = NULL,
  qtype = 8,
  roundDig = 2,
  drop0 = FALSE,
  groupvar = NULL,
  range = FALSE,
  rangesep = " ",
  rangearrow = " -> ",
  prettynum = FALSE,
  .german = FALSE,
  add_n = FALSE,
  ci = FALSE,
  nrepl = 10^3,
  singleline = TRUE
)

Arguments

x

Data for computation.

nround

Number of digits for fixed round.

qtype

Type of quantiles.

roundDig

Number of relevant digits for roundR.

drop0

Should trailing zeros be dropped?

groupvar

Optional grouping variable for subgroups.

range

Should min and max be included in output?

rangesep

How should min/max be separated from mean+-sd?

rangearrow

What is put between min -> max?

prettynum

logical, apply prettyNum to results?

.german

logical, should "." and "," be used as bigmark and decimal?

add_n

Should n be included in output?

ci

Should bootstrap based 95% confidence interval be computed?

nrepl

Number of bootstrap replications, defaults to 1000.

singleline

Put all descriptive stats in a single element (default) or below each other. singleline = FALSE sets ci and add_n as TRUE

Value

Either character vector with median [1stQuartile/3rdQuartile] and additional results (singleline), or matrix with rows for n, median with CI, and quartiles, and optionally range.

Examples

# basic usage of median_quart
median_quart(x = mtcars$wt)
# with additional options
median_quart(x = mtcars$wt, groupvar = mtcars$am, add_n = TRUE)
data(faketrial)
median_quart(x = faketrial$`Biomarker 1 [units]`, groupvar = faketrial$Treatment)

abusjahn/wrappedtools documentation built on June 10, 2025, 10:52 a.m.