getSubPop: Get subpopulation

View source: R/Population_getters.R

getSubPopR Documentation

Get subpopulation

Description

Retrieve a subset of a Population without recalculating effects

Usage

getSubPop(pop, ID)

Arguments

pop

a valid object of class Population.

ID

a vector giving the IDs of individuals to include in the subset

Details

getSubPop() returns a new Population object using the individuals with IDs specified by the vector ID.

Any additive and epistatic effects will be copied as-is to the new Population object, with heritability parameters recalculated.

Any IDs given but not present will be discarded.

Value

A new Population object containing the specified individuals is returned.

Author(s)

Dion Detterer, Paul Kwan, Cedric Gondro

See Also

Population, getComponents

Examples


# Construct a population with additive and epistatic effects
pop <- Population(
  popSize = 2000, map = map100snp, QTL = 20,
  alleleFrequencies = runif(100)
)
pop <- addEffects(pop)
pop <- attachEpiNet(pop)

# Run the simulator
pop2 <- runSim(pop, generations = 10)

# Create a new subpopulation of 500 individuals
ID <- getComponents(pop2)$ID
ID <- sample(ID, 500)
pop3 <- getSubPop(pop2, ID)


epinetr documentation built on March 18, 2022, 7:01 p.m.