Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fold

Fold a square matrix


Description

The function fold sums corresponding below and above diagonal elements of a square matrix to form a triangular matrix.

Usage

fold(X, lower = TRUE)

Arguments

X

a square matrix

lower

logical. If lower=TRUE a lower triangular matrix is formed, if not an upper triangular matrix.

Details

Useful for constructing triangular matrices of genotype counts

Value

A matrix

Author(s)

Jan Graffelman jan.graffelman@upc.edu

See Also

Examples

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)

HardyWeinberg

Statistical Tests and Graphics for Hardy-Weinberg Equilibrium

v1.7.2
GPL (>= 2)
Authors
Jan Graffelman [aut, cre], Christopher Chang [ctb], Xavi Puig [ctb], Jan Wigginton [ctb], Leonardo Ortoleva [ctb], William R. Engels [ctb]
Initial release
2021-04-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.