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

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

## Arguments

x A standardized numeric vector. The reference vector from which to compute the mean and SD. 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). Number of significant digits. May also be "scientific" to return scientific notation. For the latter case, control the number of digits by adding the value as suffix, e.g. digits = "scientific4" to have scientific notation with 4 decimal places. 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))
#> [1] -1.0 SD Mean    +1.0 SD
#> Levels: +1.0 SD Mean -1.0 SD
format_standardize(c(-1, 0, 1, 2), reference = rnorm(1000))
#> [1] -1.0 SD Mean    +1.0 SD +2.0 SD
#> Levels: +2.0 SD +1.0 SD Mean -1.0 SD
format_standardize(c(-1, 0, 1, 2), reference = rnorm(1000), robust = TRUE)
format_standardize(standardize(mtcars$wt), digits = 1) #> [1] -0.6 SD -0.3 SD -0.9 SD Mean +0.2 SD +0.2 SD +0.4 SD Mean -0.1 SD #> [10] +0.2 SD +0.2 SD +0.9 SD +0.5 SD +0.6 SD +2.1 SD +2.3 SD +2.2 SD -1.0 SD #> [19] -1.6 SD -1.4 SD -0.8 SD +0.3 SD +0.2 SD +0.6 SD +0.6 SD -1.3 SD -1.1 SD #> [28] -1.7 SD Mean -0.5 SD +0.4 SD -0.4 SD #> 23 Levels: +2.3 SD +2.2 SD +2.1 SD +0.9 SD +0.6 SD +0.5 SD +0.4 SD ... -1.7 SD format_standardize(standardize(mtcars$wt, robust = TRUE), digits = 1)