Learn R Programming

diveRsity (version 1.9.89)

haploDiv: A function, allowing the calculation of Weir & Cockerham's (1984) $F_{ST}$ from haploid genotypes in the genepop

Description

haploDiv allows users to calculate Weir & Cockerham's $F_{ST}$ from haploid genotypes for locus, global and pairwise population levels.

Usage

haploDiv(infile = NULL, outfile = NULL, pairwise = FALSE, boots = 0)

Arguments

infile
A genepop file/data frame containing haploid genotypes. This file/data frame should contain locus information in either the two digit or three digit format. The argument can be a character string indicating the name of a file or a data frame in the R workspace (e.g. see data("Test_data")).
outfile
A character string specifying a prefix to be added to output files. A character string specifying a directory location will result in the output files being written to the specified location, rather than the current working directory. If outfile = NULL, no results will be written to disk.
pairwise
Specifies whether a population pairwise matrix containing $F_{ST}$ values should be calculated.
boots
Specifies whether bootstrapped 95% confidence intervals should be calculated for each pairwise estimate of $F_{ST}$. If bootstraps = 0 and pairwise = TRUE, only a pairwise matrix of $F_{ST}$ will be returned.

Value

locus
A named vector of locus estimates of Weir & Cockerham's $F_{ST}$ across all population samples.
overall
A global estimate of Weir & Cockerham's $F_{ST}$.
pairwise
A diagonal matrix containing pairwise estimates of Weir & Cockerham's $F_{ST}$ across all loci. Returned when pairwise = TRUE.
bs_pairwise
A data frame with three data columns containing bootstrapped mean, lower 95% confidence limit and upper 95% confidence limit for each population pair (rows). Returned when bootstraps > 0 and pairwise = TRUE.

Details

This function uses the same fundamental algorithms as divPart and fastDivPart, the only difference being that if diploidizes haploid genotypes before calculating statistics. The diploidization process has the effect of changing a haploid genotype into a homozygous diploid genotype for all individuals.