fold | R Documentation |
The function fold
sums corresponding below and above diagonal elements of a square matrix to form a triangular matrix.
fold(X, lower = TRUE)
X |
a square matrix |
lower |
logical. If |
Useful for constructing triangular matrices of genotype counts
A matrix
Jan Graffelman jan.graffelman@upc.edu
lower.tri, upper.tri
allelenames <- paste("A",11:13,sep="")
allele1 <- factor(c("A11","A11","A12","A12","A13","A12"),levels=allelenames)
allele2 <- factor(c("A11","A12","A12","A13","A13","A11"),levels=allelenames)
GC <- table(allele1,allele2)
GC <- as.matrix(unclass(GC))
GCf <- fold(GC)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.