View source: R/Population_getters.R
getSubPop | R Documentation |
Retrieve a subset of a Population
without recalculating effects
getSubPop(pop, ID)
pop |
a valid object of class |
ID |
a vector giving the IDs of individuals to include in the subset |
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.
A new Population
object containing the specified
individuals is returned.
Dion Detterer, Paul Kwan, Cedric Gondro
Population
, getComponents
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.