x = nuclearPed(1) |>
addSon(3) |>
addParents(4, father = 6, mother = 7) |>
addChildren(father = 6, mother = 7, nch = 3, sex = c(2,1,2))
# Remove 6 and 7 and their descendants
y1 = removeIndividuals(x, 6:7)
# Remove 8-10 and their parents
y2 = removeIndividuals(x, 8:10, remove = "ancestors")
# Adding a child across components
z = singletons(1:2, sex = 1:2) |> addDaughter(1:2)
Run the code above in your browser using DataLab