Format numbers as correlation coefficients, by rounding them and removing the leading 0. Respects the timesaveR.round_method option for consistent rounding behavior (see round_() for details).

fmt_cor(cor_value, digits = 2)

Arguments

cor_value

Numeric, or a vector of numbers

digits

Number of significant digits, defaults to 2

Examples

fmt_cor(0.127)
#> [1] ".13"
fmt_cor(c(0.456, -0.789, 0.023))
#> [1] ".46"  "-.79" ".02"