print_mean_sd: Print mean and standard deviation

View source: R/print_mean_sd.R

print_mean_sdR Documentation

Print mean and standard deviation

Description

Print mean and standard deviation

Usage

print_mean_sd(
  x,
  decimals_M = 2,
  decimals_SD = 2,
  parentheses = TRUE,
  short = FALSE,
  na.rm = FALSE
)

Arguments

x

a vector of the sample the statistics should be printed for.

decimals_M

how many decimals should be printed for the mean (defaults to 2).

decimals_SD

how many decimals should be printed for the standard deviation (defaults to 2).

parentheses

logical indicating if the statistics should be wrapped in parentheses or not (defaults to TRUE). Will be ignored if short is TRUE.

short

logical indicating if a short version without the letters should be printed. Argument parantheses is ignored in this case. Defaults to FALSE. See details.

na.rm

logical indicating whether missing values should be ignored or not. Defaults to FALSE.

Details

The following formatting options are available:

- When parentheses is TRUE: (M = XX, SD = XX)

- When parentheses is FALSE: M = XX, SD = XX

- When short is TRUE: XX (XX)

Author(s)

Juliane Tkotz juliane.tkotz@hhu.de

Examples


print_mean_sd(rnorm(100, 0, 1))

print_mean_sd(1:20, decimals_M = 0, decimals_SD = 3)

print_mean_sd(c(2, 10, 12.5, 3), parentheses = FALSE)


m-Py/prmisc documentation built on Aug. 23, 2023, 1:20 a.m.