to_mv_freq: Returns mv frequencies for stratum in long format

View source: R/to_mv_freq.R

to_mv_freqR Documentation

Returns mv frequencies for stratum in long format

Description

This function takes a data.frame of data and returns a matrix of allele frequencies where each row is a stratum and each column is an allele frequency (all lumped together).

Usage

to_mv_freq(x, stratum = "Population", drop.allele = FALSE)

Arguments

x

A data.frame object with locus columns

stratum

The stratum to use to partition the data (default "Population")

drop.allele

A flag (default FALSE) that drops the lowest frequency allele from the result (so all rows do not sum) to the same value.

Value

A matrix with as many rows as strata and columns as alleles across all loci.

Author(s)

Rodney J. Dyer rjdyer@vcu.edu

Examples

  AA <- locus( c("A","A") )
  AB <- locus( c("A","B") )
  AC <- locus( c("A","C") )
  BB <- locus( c("B","B") )
  BC <- locus( c("B","C") )
  CC <- locus( c("C","C") )
  loci <- c(AA,AA,AB,AA,BB,BC,CC,BB,BB,CC)
  df <- data.frame( Population=c(rep("A",5),rep("B",5) ), TPI=loci )
  to_mv_freq(df)

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