fashion: Fashion a correlation data frame for printing.

View source: R/output.R

fashionR Documentation

Fashion a correlation data frame for printing.

Description

For the purpose of printing, convert a correlation data frame into a noquote matrix with the correlations cleanly formatted (leading zeros removed; spaced for signs) and the diagonal (or any NA) left blank.

Usage

fashion(x, decimals = 2, leading_zeros = FALSE, na_print = "")

Arguments

x

Scalar, vector, matrix or data frame.

decimals

Number of decimal places to display for numbers.

leading_zeros

Should leading zeros be displayed for decimals (e.g., 0.1)? If FALSE, they will be removed.

na_print

Character string indicating NA values in printed output

Value

noquote. Also a data frame if x is a matrix or data frame.

Examples

# Examples with correlate()
library(dplyr)
mtcars %>% correlate() %>% fashion()
mtcars %>% correlate() %>% fashion(decimals = 1)
mtcars %>% correlate() %>% fashion(leading_zeros = TRUE)
mtcars %>% correlate() %>% fashion(na_print = "*")

# But doesn't have to include correlate()
mtcars %>% fashion(decimals = 3)
c(0.234, 134.23, -.23, NA) %>% fashion(na_print = "X")

corrr documentation built on Aug. 17, 2022, 1:05 a.m.