Skip to contents

Turns a smart_cormat() result into a long tibble with one row per variable pair (lower triangle only, no self-correlations).

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 × 20
#>   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.0192  pears… Pearson Cor… One vari…     1.05 
#> 2 age    sex    count    binary -0.00870 point… Point-Biser… One vari…    -0.476
#> 3 coninc sex    continu… binary -0.101   point… Point-Biser… One vari…    -5.55 
#> # ℹ 11 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>