format_ms: Format summaries for tables

View source: R/functions.R

format_msR Documentation

Format summaries for tables

Description

Cole, TJ (2015) Too many digits: presentation of numerical data. Archives of Disease in Childhood 100(7), 608-609.

Usage

format_ms(x, figs = 3, sigfig = TRUE, use_quantiles = FALSE)

Arguments

x

Numeric vector to be summarised

figs

Number of digits or significant figure to print

sigfig

If TRUE, figs is interpreted as significant figures; if FALSE, figs is interpreted as number of digits. If significant figures are used, these are applied to the mean or median. Standard deviation or first/third quartiles are printed with the same number of digits as the mean or median.

use_quantiles

If TRUE, output is median (IQR). If FALSE, output is mean (SD).

Value

A string, formatted as median (IQR) or mean (SD) with the chosen number of digits / significant figures, suitable for display in tables.


simisc/whozr documentation built on March 24, 2023, 5:14 p.m.