| expand_pedmat | R Documentation |
Restores a compact pedmat to its original dimensions by mapping each individual to their family representative's values. For non-compact matrices, returns the matrix unchanged.
expand_pedmat(x)
x |
A pedmat object from |
For compact matrices, full-siblings within the same family will have identical relationship values in the expanded matrix because they shared the same representative during calculation.
Matrix or vector with original pedigree dimensions:
Matrices: Row and column names set to all individual IDs
Vectors (e.g., method="f"): Names set to all individual IDs
The result is not a pedmat object (S3 class stripped).
pedmat, query_relationship
tped <- tidyped(small_ped)
# Compact matrix
A_compact <- pedmat(tped, method = "A", compact = TRUE)
dim(A_compact) # Reduced dimensions
# Expand to full size
A_full <- expand_pedmat(A_compact)
dim(A_full) # Original dimensions restored
# Non-compact matrices are returned unchanged
A <- pedmat(tped, method = "A", compact = FALSE)
A2 <- expand_pedmat(A)
identical(dim(A), dim(A2)) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.