freq2GenData | R Documentation |
Create a data frame of stratified individuals and their haplotypes from a frequency table
freq2GenData( freq.mat, hap.col = NULL, freq.col = 1, id.label = NULL, hap.label = NULL )
freq.mat |
a matrix or data.frame containing haplotypic frequencies with strata as column names. |
hap.col |
a number giving the column providing haplotype
labels or a vector the same length as freq.mat. If |
freq.col |
a number giving the first column containing haplotype frequencies. |
id.label |
character to label sample IDs with in resulting data.frame. |
hap.label |
character to label haplotypes with in resulting data.frame. |
a data frame with one row per sample and columns for id, strata, and haplotype, suitable for use in df2gtypes.
Eric Archer eric.archer@noaa.gov
hap.freqs <- data.frame( haps = c("hap1", "hap2", "hap3"), pop1 = rmultinom(1, 50, prob = c(0.1, 0.2, 0.7)), pop2 = rmultinom(1, 25, prob = c(0.5, 0.4, 0.1)) ) gen.data <- freq2GenData(hap.freqs, hap.col = 1, freq.col = 2) x <- df2gtypes(gen.data, ploidy = 1) summary(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.