character, column name in x holding individual
identifications
genotype
character, column name in x holding genotypes
prob
character, column name in x holding genotype
probabilities
trim
logical, remove last column (for gpLong2Wide) or
value (for hwp) of a result
Value
gpLong2Wide returns a matrix with number of rows equal to number
of individuals and number of columns equal to number of possible
genotypes.hwp returns a vector with Hardy-Weinberg genotype probabilities.
Details
Hardy-Weinberg probabilities for a gene with two alleles A and B, with
probabilities $Pr(A)$ and $Pr(B)$ are: