Hi: Estimate Individual Heterozygosity Returns the heterozygosity...

View source: R/hi.R

HiR Documentation

Estimate Individual Heterozygosity Returns the heterozygosity of loci within each individual. This is a per-individual estiamte

Description

Estimate Individual Heterozygosity

Returns the heterozygosity of loci within each individual. This is a per-individual estiamte

Usage

Hi(x)

Arguments

x

A data.frame that has rows of individuals who have one or more locus columns

Value

The average heterozygosity for non-missing loci per individual as a data.frame object with all non-locus columns identical to those passed.

Note

This function must be called on a data.frame of individuals, it will assume that each row contains at least one column of type locus

Author(s)

Rodney J. Dyer rjdyer@vcu.edu

Examples

loc1 <- c( locus( c("A","A") ), locus( c("A","B") ), locus( c("A","B") ) )
loc2 <- c( locus( c("A","B") ), locus( c("A","A") ), locus( c("A","B") ) )
loc3 <- c( locus( c("A","B") ), locus( c("A","A") ), locus( c("A","B") ) )
loc4 <- c( locus( c("A","A") ), locus( c("A","A") ), NA )
pop <- c("A","A","B")
df <- data.frame( ID = 1:3, pop, loc1, loc2, loc3, loc4 )
Hi( df )

dyerlab/gstudio documentation built on Feb. 2, 2024, 8:24 p.m.