| randomPed | R Documentation | 
Generate a random connected pedigree by applying random mating starting from a finite population.
randomPed(n, founders = 2, maxDirectGap = 1, selfing = FALSE, seed = NULL)
n | 
 A positive integer: the total number of individuals. Must be at least 3.  | 
founders | 
 A positive integer: the number of founders. Must be at least 2 unless selfing is allowed.  | 
maxDirectGap | 
 An integer; the maximum distance between direct
descendants allowed to mate. For example, the default value of 1 allows
parent-child mating, but not grandparent-grandchild. Use   | 
selfing | 
 A logical indicating if selfing is allowed. Default: FALSE.  | 
seed | 
 An integer seed for the random number generator (optional).  | 
Starting from an initial set of founders, a sequence of n - founders random
matings is simulated. The sampling of parents in each mating is set up to
ensure that the final result is connected.
A connected pedigree returned as a ped object.
plot(randomPed(n = 7, seed = 12))
# Disallow mating between direct descendants
plot(randomPed(n = 7, seed = 12, maxDirectGap = 0))
# No restrictions on mating between direct descendants
plot(randomPed(n = 7, seed = 12, maxDirectGap = Inf))
# Allow selfing
y = randomPed(5, seed = 2, selfing = TRUE)
hasSelfing(y)
y
plot(y, arrows = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.