r2_to_r: Convert r^2 to r, and vice versa

View source: R/r2_to_r.R

r2_to_rR Documentation

Convert r2 to r, and vice versa

Description

Infers which LD correlation metric the LD_matrix currently contains, and converts it to the requested LD correlation metric. NOTE: Since +/- valence cannot be recovered from an r2 matrix, r2 can only be converted to absolute r.

Usage

r2_to_r(LD_matrix, LD_path = "", stats = "R", verbose = TRUE)

Arguments

LD_matrix

LD matrix.

LD_path

[Optional] Path where LD matrix is stored. This is used to determine whether the matrix has already been converted to absolute r based on the presence of the "rAbsolute" substring (to avoid taking the square root twice).

stats

The linkage disequilibrium measure to be calculated. Can be "R" (default) or "R.squared".

verbose

Print messages.

Value

Named list containing the LD matrix and which LD metric is has been formatted to.

Examples

LD_matrix <- echodata::BST1_LD_matrix
r2r_out <- r2_to_r(LD_matrix = LD_matrix)

RajLabMSSM/echoLD documentation built on May 12, 2024, 3:23 a.m.