Learn R Programming

HardyWeinberg (version 1.7.8)

he: Calculate expected heterozygosity (He)

Description

Function he calculates the expected heterozygosity for a biallelic genetic variant.

Usage

he(x, bias.correct = TRUE)

Value

a vector of expected heterozygosities.

Arguments

x

a vector or matrix with genotype counts.

bias.correct

if bias.correct = TRUE a correction for bias will be applied.

Author

Jan Graffelman (jan.graffelman@upc.edu)

Details

x can be a vector of genotype counts for a single marker (AA,AB,BB) or a three-column matrix of genotype counts for multiple markers.

See Also

af, maf.

Examples

Run this code
#
# He for a single marker
#
x <- c(MM=298,MN=489,NN=213)
he(x)
#
# He for a matrix of rmarkers
#
set.seed(123)
X <- HWData(10,100)
he(X)
he(X,bias.correct = FALSE)

Run the code above in your browser using DataLab