Skip to contents

Turns a smart_cormat() result into a long tibble with one row per variable pair (lower triangle only, no self-correlations). If nearPD = TRUE was used, estimates and inference refer to the original pairs, before the matrix adjustment.

Usage

# S3 method for class 'smartcormat'
tidy(x, ...)

Arguments

x

A smartcormat object.

...

Ignored.

Value

A tibble::tibble() with the same columns as tidy.smartcor(), one row per unique pair.

Examples

csv = system.file("extdata", "gss_2024_casestudy.csv", package = "smartcor")
gss = read.csv(csv)
mat = smart_cormat(
  gss[, c("age", "coninc", "sex")],
  assume_latent_normal = FALSE,
  verbose = FALSE
)
tidy(mat)
#> # A tibble: 3 × 24
#>   var_x  var_y  x_type   y_type estimate method method_label rationale statistic
#>   <chr>  <chr>  <chr>    <chr>     <dbl> <chr>  <chr>        <chr>         <dbl>
#> 1 age    coninc count    conti…   0.0369 spear… Spearman Ra… Sorted r…   4.33e+9
#> 2 age    sex    count    binary  -0.0104 rank_… Rank-Biseri… The Jarq…  -4.91e-1
#> 3 coninc sex    continu… binary  -0.134  rank_… Rank-Biseri… The Jarq…  -6.32e+0
#> # ℹ 15 more variables: p.value <dbl>, p_method <chr>, null_hypothesis <chr>,
#> #   p_interpretation <chr>, ci_lower <dbl>, ci_upper <dbl>, conf_level <dbl>,
#> #   ci_method <chr>, ci_source <chr>, n <int>, n_complete <int>,
#> #   outlier_flag <lgl>, normality_p <dbl>, latent_p <dbl>, linearity_p <dbl>