Last chance! 50% off unlimited learning
Sale ends in
linkdat
objects with common pedigree structures.
The function nuclearPed
creates a nuclear family with a specified number of male/female offspring, while cousinPed
and halfCousinPed
create pedigrees linking two (half) cousins of a specified degree.nuclearPed(noffs, sex)
cousinPed(degree)
halfCousinPed(degree)
noffs
; indicating the gender (1=male, 2=female) of the offspring. If missing, all offspring are taken to be males.linkdat
object.swapAff
to edit this (see Examples).
Use swapSex
to change gender of pedigree members.
The cousins created by cousinPed
and halfCousinPed
have zero removal. Removals are easily contructed using addOffspring
or removeIndividuals
(see Examples).swapAff
, swapSex
, removeIndividuals
, addOffspring
, relabel
# A nuclear family with 2 boys and 3 girls,
# where the father and the two boys are affected.
x = nuclearPed(noffs=5, sex=c(1,1,2,2,2))
x = swapAff(x, ids=c(1,3,4))
# A pedigree showing a pair of third cousins
y = cousinPed(3)
plot(y)
# Adding a child on one side, to create third cousins once removed.
# The pedigree plot above helps identifying which individual
# should have the extra child
y = addOffspring(y, father=15, noffs=1)
# Half sibs:
z = halfCousinPed(0)
# Alternative construction:
z2 = addOffspring(nuclearPed(1), father=1, noffs=1, sex=2)
z2 = relabel(z2, new=3:4, old=4:3)
stopifnot(all.equal(z,z2))
Run the code above in your browser using DataLab