Pretty formatting of correlation coefficients

formatR(r, digits = 2)

Arguments

r

The Pearson correlation to format.

digits

The number of digits to round to.

Value

The formatted correlation.

See also

noZero(), formatCI(), formatPvalue()

Examples

formatR(cor(mtcars$mpg, mtcars$disp));
#> [1] "-.85"