tidy.cor_matrix: Tidy a correlation matrix

tidy.cor_matrixR Documentation

Tidy a correlation matrix

Description

This function turns the correlation matrix returned by cor_matrix() and its relatives into a tidy dataframe. Note that by default, results for both the cor(A, B) and cor(B, A) are returned, while entries for ⁠A, A⁠, i.e. the values on the diagonal, are never included.

Usage

## S3 method for class 'cor_matrix'
tidy(x, both_directions = TRUE, ...)

Arguments

x

A cor_marix object returned from cor_matrix()

both_directions

Should both cor(A, B) and cor(B, A) be returned. Defaults to TRUE.

...

Additional arguments. Not used. Needed to match generic signature only.

Value

A tibble::tibble() with columns:

column1

Name of the first variable

column2

Name of the second variable

estimate

The estimated value of the correlation

statistic

The t-statistic used for significance testing

p.value

The two-sided p-value of the correlation

n

Number of observations used to compute the correlation

ci.low

Lower bound of confidence interval. Width is determined in call to cor_matrix()

ci.high

Upper bound of confidence interval. Width is determined in call to cor_matrix()


LukasWallrich/timesaveR documentation built on Nov. 29, 2024, 4:47 a.m.