View source: R/fam_ancestors.R
fam_ancestors | R Documentation |
G
-generations deepCreates an idealized pedigree listing all ancestors of one individual starting from G
generations ago, without inbreeding (a binary tree).
IDs are automatically generated strings indicating generation and individual number within generation.
Useful for simple simulations of individuals with explicit ancestors.
fam_ancestors(G)
G |
The desired number of generations.
|
A list with two named elements:
fam
: a tibble describing the pedigree, with the following columns
id
: The ID of each individual, a string in the format "g-i" joining with a dash the generation number ("g", numbered backward in time) and the individual number within the generation ("i").
pat
: The paternal ID. For individual "g-i" parent is (g+1)"-"(2*i-1), except for last generation it is NA
(their parents are missing).
mat
: The maternal ID. For individual "g-i" parent is (g+1)"-"(2*i), except for last generation it is NA
(their parents are missing).
sex
: 1 (male) for all odd-numbered individuals, 2 (female) for even-numbered individuals, consistent with pedigree structure. Side-effect is first-generation individual ("1-1") is always male (edit afterwards as desired).
ids
: A list containing vectors of IDs separated by generation, but here starting from the last generation (highest "g"), to be consistent with output of sim_pedigree()
and the expected input of all *_last_gen
functions.
sim_pedigree()
to simulate a random pedigree with a given number of generations, generation sizes, and other parameters.
# construct the 8-generation ancestor tree of one individual: data <- fam_ancestors( 8 ) # this is the pedigree fam <- data$fam # and this is the handy list of IDs by discrete generation, # used by `*_last_gen` functions to reduce memory usage ids <- data$ids
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.