format_standardize: Format a Standardized Vector

View source: R/format_standardize.R

format_standardizeR Documentation

Format a Standardized Vector

Description

Transform a standardized vector into character, e.g., c("-1 SD", "Mean", "+1 SD").

Usage

format_standardize(
  x,
  reference = x,
  robust = FALSE,
  digits = 1,
  protect_integers = TRUE,
  ...
)

Arguments

x

A standardized numeric vector.

reference

The reference vector from which to compute the mean and SD.

robust

Logical, if TRUE, centering is done by subtracting the median from the variables and dividing it by the median absolute deviation (MAD). If FALSE, variables are standardized by subtracting the mean and dividing it by the standard deviation (SD).

digits

Number of digits for rounding or significant figures. May also be "signif" to return significant figures or "scientific" to return scientific notation. Control the number of digits by adding the value as suffix, e.g. digits = "scientific4" to have scientific notation with 4 decimal places, or digits = "signif5" for 5 significant figures (see also signif()).

protect_integers

Should integers be kept as integers (i.e., without decimals)?

...

Other arguments to pass to insight::format_value() such as digits, etc.

Examples

format_standardize(c(-1, 0, 1))
format_standardize(c(-1, 0, 1, 2), reference = rnorm(1000))
format_standardize(c(-1, 0, 1, 2), reference = rnorm(1000), robust = TRUE)

format_standardize(standardize(mtcars$wt), digits = 1)
format_standardize(standardize(mtcars$wt, robust = TRUE), digits = 1)

effectsize documentation built on July 3, 2024, 9:07 a.m.