Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

umx_cor

Report correlations and their p-values


Description

For reporting correlations and their p-values in a compact table. Handles rounding, and skipping non-numeric columns.

Usage

umx_cor(
  X,
  df = nrow(X) - 2,
  use = c("pairwise.complete.obs", "complete.obs", "everything", "all.obs",
    "na.or.complete"),
  digits = 2,
  type = c("r and p-value", "smart")
)

Arguments

X

a matrix or dataframe

df

the degrees of freedom for the test

use

how to handle missing data (defaults to pairwise complete)

digits

rounding of answers

type

Unused argument for future directions

Details

To compute heterochoric correlations, see umxHetCor().

note: The Hmisc package has a more robust function called rcorr.

Value

  • Matrix of correlations and p-values

References

See Also

umxHetCor

Examples

tmp = myFADataRaw[1:8,1:8]
umx_cor(tmp)
tmp$x1 = letters[1:8] # make one column non-numeric
umx_cor(tmp)

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.