############
# Example 1
# A family trio where each parent have first cousin parents.
############
# Trio
x = nuclearPed(1)
# Add paternal family
pat = cousinPed(1, child = TRUE)
x = mergePed(x, pat, by = c("1" = "9"))
# Maternal family
mat = cousinPed(1, child = TRUE) |> swapSex("9")
x = mergePed(x, mat, by = c("2" = "9"))
# Relabel (Alternative: add `relabel = TRUE` in the previous call)
x = relabel(x, "asPlot")
plot(x)
##################################
# Example 2: Double first cousins
##################################
# First cousins, whose fathers are brothers
y = cousinPed(degree = 1)
# Create two sisters
motherPed = nuclearPed(2, sex = 2)
# Plot to see who is who: `plotPedList(list(y, motherPed))`
# Merge
z = mergePed(y, motherPed, by = c("4" = 3, "6" = 4), relabel = TRUE)
plot(z)
Run the code above in your browser using DataLab