make_population: Makes a random population

View source: R/make_population.R

make_populationR Documentation

Makes a random population

Description

This function takes a frequencies() object and returns a data.frame with the appropriate stratum and loci derived randomly.

Usage

make_population(x, N = 20, F = 0)

Arguments

x

A data.frame as returned by the frequencies() function. For a single locus, it has columns "Allele" and "Frequency" for multiple loci, it has a "Locus" column, and if it is to be subdivided into strata, you have a "Strata" column.

N

The number of individuals to create (default = 20). This is a 'per-stratum' estimate so if you have K strata the result will be K*N individuals.

F

The inbreeding index (Fis).

Value

A data.frame with individuals, loci, and potentially strata

Author(s)

Rodney J. Dyer rjdyer@vcu.edu

Examples

  freqs <- c(0.55, 0.30, 0.15, 0.34, 0.34, 0.32)
  loci <- c(rep("TPI",3), rep("PGM",3))
  alleles <- c(LETTERS[1:3],LETTERS[8:10])
  f <- data.frame(Locus=loci, Allele=alleles, Frequency=freqs)
  make_population(f,N=20)

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