format_lddf {ldsep} | R Documentation |
Format an element of mldest()
or
sldest()
into an
upper-triangular matrix.
Description
Formats the LD estimates and standard errors output
from running mldest()
or sldest()
into a more conventional upper-triangular matrix.
Usage
format_lddf(obj, element = "r2")
Arguments
obj |
An object of class |
element |
Which element in |
Value
A matrix of the selected elements. Only the upper-triangle of the
matrix is filled. The lower-triangle and the diagonal are NA
's.
Author(s)
David Gerard
Examples
set.seed(1)
## Simulate genotypes when true correlation is 0
nloci <- 5
nind <- 100
K <- 6
nc <- 1
genomat <- matrix(sample(0:K, nind * nloci, TRUE), nrow = nloci)
## Haplotypic LD estimates
lddf <- mldest(geno = genomat,
K = K,
nc = nc,
type = "hap")
## Obtain the D estimates in matrix form
Dmat <- format_lddf(obj = lddf, element = "D")
Dmat
[Package ldsep version 2.1.5 Index]