Skip to contents

This function returns a character vector with mean and sd or median and iqr as a inline summary statistics for reports or articles in R markdown or plain text.

Usage

cent_disp(
  x,
  type = if (is.null(str.a)) "auto" else "custom",
  str.a = NULL,
  k = 1,
  markdown = TRUE
)

Arguments

x

Numeric vector.

type

To choose a parametric (type = 'p') estimate (i.e. mean and sd) or a non-parametric one (type = 'np', median and iqr). Can be choosen automatically with type = 'auto. It can be set to 'custom' so you can insert your own expresions using glue syntax in str.a argument.

str.a

Works only when type = 'custom'. Allows you to set your own expresions using glue syntax, e.g. str.a = "{median} (*MAD* = {mad}, *IQR* = {IQR})

k

Number of decimals.

markdown

Whether you want the output formated for inline R markdown (TRUE) or as plain text (FALSE).

Value

A character vector of length one.