Fold a square matrix
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
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.