
Last chance! 50% off unlimited learning
Sale ends in
Utility functions for creating some common pedigree structures.
nuclearPed(nch = 1, sex = 1, father = "1", mother = "2", children = NULL)halfSibPed(
nch1 = 1,
nch2 = 1,
sex1 = 1,
sex2 = 1,
type = c("paternal", "maternal")
)
linearPed(n, sex = 1)
cousinPed(degree, removal = 0, side = c("right", "left"), child = FALSE)
halfCousinPed(degree, removal = 0, side = c("right", "left"), child = FALSE)
ancestralPed(g)
selfingPed(s, sex = 1)
The number of children, by default 1. If children
is not NULL,
nch
is set to length(children)
A vector with integer gender codes (0=unknown, 1=male, 2=female).
In nuclearPed()
, it contains the genders of the children and is recycled
(if necessary) to length nch
. In linearPed()
it also contains the
genders of the children (1 in each generation) and should have length at
most n
(recycled if shorter than this). In selfingPed()
it should be a
single number, indicating the gender of the last individual (the others
must necessarily have gender code 0.)
The label of the father. Default: "1".
The label of the mother. Default: "2".
A character with labels of the children. Default: "3", "4", ...
The number of children in each sibship.
Vectors of gender codes for the children in each sibship.
Recycled (if necessary) to lengths nch1
and nch2
respectively.
Either "paternal" or "maternal".
The number of generations, not including the initial founders.
A non-negative integer: 0=siblings, 1=first cousins; 2=second cousins, a.s.o.
A non-negative integer. See Details and Examples.
Either "right" or "left"; the side on which removals should be added.
A logical: Should an inbred child be added to the two cousins?
A nonnegative integer indicating the number of ancestral generations
to include. The resulting pedigree has 2^(g+1)-1
members. The case g = 0
results in a singleton.
A nonnegative integer indicating the number of consecutive selfings.
The case s = 0
results in a singleton.
A ped
object.
halfSibPed(nch1, nch2)
produces a pedigree containing two sibships (of
sizes nch1
and nch2
) with the same father, but different mothers. If
maternal half sibs are wanted instead, add type = "maternal"
.
cousinPed(degree = n, removal = k)
creates a pedigree with two n
'th
cousins, k
times removed. By default, removals are added on the right side,
but this can be changed by adding side = left
. (Similarly for
halfCousinPed
.)
ancestralPed(g)
returns the family tree of a single individual, including
all ancestors g
generations back.
selfingPed(s)
returns a line of s
consecutive selfings.
# NOT RUN {
# A nuclear family with 2 boys and 3 girls
nuclearPed(5, sex = c(1, 1, 2, 2, 2))
# A straight line of females
linearPed(3, sex = 2)
# Paternal half brothers
halfSibPed()
# Maternal half sisters
halfSibPed(sex1 = 2, sex2 = 2, type = "maternal")
# Larger half sibships: boy and girl on one side; 3 girls on the other
halfSibPed(nch1 = 2, sex = 1:2, nch2 = 3, sex2 = 2)
# Grand aunt:
cousinPed(degree = 0, removal = 2)
# Second cousins once removed.
cousinPed(degree = 2, removal = 1)
# Same, but with the 'removal' on the left side.
cousinPed(2, 1, side = "left")
# A child of half first cousins.
halfCousinPed(degree = 1, child = TRUE)
# The 'family tree' of a person
ancestralPed(g = 2)
# }
Run the code above in your browser using DataLab