Description Usage Arguments Details Value Author(s) See Also Examples
generation
calculates generation value of individuals in given
pedigree. generation<-
provides a way to properly add generation
information into the pedigree.
1 2 | generation(x, start=1, generationOrder=NULL)
generation(x, generationOrder=NULL, col=NULL) <- value
|
x |
pedigree object |
start |
first generation value |
generationOrder |
character, should be generation values "increasing" or "decreasing" through generations, see details |
col |
character, column name in |
value |
generation values for individuals in the pedigree |
Generation value for founders is set to value start
, which is by
default 1, while other individuals get it according to:
G_s = max(G_{1a} + G_{2a} + ... G_{na}) + 1
where G represents generation value for s - individual, a - ascendant e.g. father and mother, where n=2. N might be higher if there are multiple ascendants i.e. this function can also handle pedigrees with higher order ascendants e.g. grandfather.
generationOrder
can be used to define "increasing" or
"decreasing" order of generation values. If this argument is
NULL
, which is default, then this information is taken from
the pedigree - see Pedigree
for more on this issue.
col
provides a way to name or possibly also rename generation
column with user specified value, say "generazione" in Italian. When
col=NULL
, which is default, "generation" is used.
A vector of generation values (integers)
Gregor Gorjanc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Nonoverlapping pedigree
ped <- generatePedigree(nId=5, nGeneration=4, nFather=1, nMother=2)
ped$generation1 <- generation(ped)
ped
# Overlapping Pedigree
ped <- data.frame( id=c(1, 2, 3, 4, 5, 6, 7),
father=c(0, 0, 2, 2, 2, 4, 4),
mother=c(0, 0, 1, 0, 3, 3, 5),
dtBirth=c(2, 1, 3, 4, 5, 6, 7))
ped <- Pedigree(ped, unknown=0, dtBirth="dtBirth")
generation(ped) <- generation(ped)
# Overlapping pedigree + one individual (4) comes late in pedigree and
# has no ascendants
ped <- data.frame( id=c(1, 2, 3, 4, 5, 6, 7),
father=c(0, 0, 2, 0, 2, 4, 4),
mother=c(0, 0, 1, 0, 3, 3, 5),
dtBirth=c(2, 1, 3, 2, 5, 6, 7))
ped <- Pedigree(ped, unknown=0, dtBirth="dtBirth")
generation(ped)
generation(ped, generationOrder="decreasing",
col="generazione") <- generation(ped, generationOrder="decreasing")
|
Loading required package: MASS
Attaching package: 'GeneticsPed'
The following object is masked from 'package:stats':
family
id father mother generation sex generation1
1 1 NA NA 1 1 1
2 2 NA NA 1 1 1
3 3 NA NA 1 2 1
4 4 NA NA 1 2 1
5 5 NA NA 1 2 1
6 6 1 4 2 1 2
7 7 1 4 2 2 2
8 8 1 4 2 2 2
9 9 1 4 2 2 2
10 10 1 4 2 1 2
11 11 6 9 3 1 3
12 12 6 9 3 2 3
13 13 6 8 3 2 3
14 14 6 9 3 2 3
15 15 6 8 3 2 3
16 16 11 14 4 1 4
17 17 11 14 4 2 4
18 18 11 13 4 1 4
19 19 11 13 4 2 4
20 20 11 13 4 2 4
1 2 3 4 5 6 7
1 1 2 1 3 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.