Description Usage Arguments Details Value Author(s) See Also Examples
Pedigree sort
1 2 |
x |
pedigree, object to be sorted |
decreasing |
logical, sort order |
na.last |
logical, control treatment of |
... |
arguments passed to |
by |
character, sort by "default", "pedigree", "generation", or "dtBirth" information, see details |
Sorting of the pedigree can be performed in different ways. Since
pedigree can contain date of birth, sorting by this would be the most
obvious way and it would be the most detailed sort. However, there might
be the case that date of birth is not available for some or all
individuals. Therefore, this function by default (when
by="default"
) tries to figure out what would be the best way to
perform the sort. If date of birth is available for all individuals then
date of birth is used for sorting. If not, generation information is
used, but only if it is known for all individuals (it should be more or
less easy to figure out the generation for all individuals in the
pedigree CHECK). Again if not, sorting is done via information in
pedigree i.e. ascendants will precede descendants or vice versa. User
can always define it's own preference by argument by
. When
by="dtBirth"
or by="generation"
sorting is performed via
order
and its arguments na.last
and
decreasing
can be used. With by="pedigree"
argument
decreasing
has an effect.
Generation values can have different meaning i.e. values might either
increase or decrease from ascendants to descendant with the same
meaning. This information is stored in attribute generationOrder
(at the time of creating the pedigree object via Pedigree
)
and used for determining the order of sorting if sorting is by
generation. The output of the result might therefore be opposite of what
user might expect. If that is the case, use argument decreasing
as defined in order
. Look also into examples bellow.
Sorted pedigree
Gregor Gorjanc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ped <- generatePedigree(nId=5)
ped <- ped[sample(1:nrow(ped)), ]
sort(ped)
## sort(ped, by="dtBirth") ## TODO
sort(ped, by="generation")
## try(sort(ped, by="pedigree")) ## TODO
## Sorting with decreasing generation values from ascendants to descendants
ped1 <- generatePedigree(nId=5, generationOrder="decreasing")
sort(ped1, by="generation")
sort(ped1, decreasing=TRUE, by="generation")
sort(ped1, decreasing=FALSE, by="generation")
## Sorting with unknown values
ped[1, "generation"] <- NA
sort(ped, na.last=TRUE, by="generation")
sort(ped, na.last=FALSE, by="generation")
sort(ped, na.last=NA, by="generation")
|
Loading required package: MASS
Attaching package: 'GeneticsPed'
The following object is masked from 'package:stats':
family
id father mother generation sex
5 5 NA NA 1 2
4 4 NA NA 1 1
1 1 NA NA 1 1
3 3 NA NA 1 2
2 2 NA NA 1 1
7 7 1 5 2 1
9 9 1 5 2 2
6 6 2 3 2 1
8 8 2 3 2 2
10 10 2 5 2 2
13 13 6 9 3 1
12 12 6 8 3 1
11 11 7 10 3 2
15 15 6 8 3 2
14 14 6 10 3 1
id father mother generation sex
5 5 NA NA 1 2
4 4 NA NA 1 1
1 1 NA NA 1 1
3 3 NA NA 1 2
2 2 NA NA 1 1
7 7 1 5 2 1
9 9 1 5 2 2
6 6 2 3 2 1
8 8 2 3 2 2
10 10 2 5 2 2
13 13 6 9 3 1
12 12 6 8 3 1
11 11 7 10 3 2
15 15 6 8 3 2
14 14 6 10 3 1
id father mother generation sex
11 11 6 9 1 1
12 12 6 9 1 2
13 13 7 8 1 2
14 14 6 8 1 2
15 15 6 8 1 2
6 6 1 5 2 1
7 7 2 4 2 1
8 8 2 5 2 2
9 9 2 4 2 2
10 10 2 3 2 2
1 1 NA NA 3 1
2 2 NA NA 3 1
3 3 NA NA 3 2
4 4 NA NA 3 2
5 5 NA NA 3 2
id father mother generation sex
1 1 NA NA 3 1
2 2 NA NA 3 1
3 3 NA NA 3 2
4 4 NA NA 3 2
5 5 NA NA 3 2
6 6 1 5 2 1
7 8 2 5 2 1
8 7 2 4 2 2
9 9 2 4 2 2
10 10 2 3 2 2
11 11 6 9 1 1
12 12 6 9 1 2
13 13 7 8 1 2
14 14 6 8 1 2
15 15 6 8 1 2
id father mother generation sex
11 11 6 9 1 1
12 12 6 9 1 2
13 13 7 8 1 2
14 14 6 8 1 2
15 15 6 8 1 2
6 6 1 5 2 1
7 7 2 4 2 1
8 8 2 5 2 2
9 9 2 4 2 2
10 10 2 3 2 2
1 1 NA NA 3 1
2 2 NA NA 3 1
3 3 NA NA 3 2
4 4 NA NA 3 2
5 5 NA NA 3 2
id father mother generation sex
5 5 NA NA 1 2
4 4 NA NA 1 1
1 1 NA NA 1 1
3 3 NA NA 1 2
2 2 NA NA 1 1
9 9 1 5 2 2
6 6 2 3 2 1
8 8 2 3 2 2
10 10 2 5 2 2
13 13 6 9 3 1
12 12 6 8 3 1
11 11 7 10 3 2
15 15 6 8 3 2
14 14 6 10 3 1
7 7 1 5 NA 1
id father mother generation sex
7 7 1 5 NA 1
5 5 NA NA 1 2
4 4 NA NA 1 1
1 1 NA NA 1 1
3 3 NA NA 1 2
2 2 NA NA 1 1
9 9 1 5 2 2
6 6 2 3 2 1
8 8 2 3 2 2
10 10 2 5 2 2
13 13 6 9 3 1
12 12 6 8 3 1
11 11 7 10 3 2
15 15 6 8 3 2
14 14 6 10 3 1
id father mother generation sex
5 5 NA NA 1 2
4 4 NA NA 1 1
1 1 NA NA 1 1
3 3 NA NA 1 2
2 2 NA NA 1 1
9 9 1 5 2 2
6 6 2 3 2 1
8 8 2 3 2 2
10 10 2 5 2 2
13 13 6 9 3 1
12 12 6 8 3 1
11 11 7 10 3 2
15 15 6 8 3 2
14 14 6 10 3 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.