Learn R Programming

pedtools (version 1.1.0)

mergePed: Merge two pedigrees

Description

This function merges two ped objects, joining them at the individuals with equal ID labels. This is especially useful for building 'top-heavy' pedigrees. Only ped objects without marker data are supported.

Usage

mergePed(x, y, ...)

Arguments

x, y

ped() objects

...

further arguments passed along to ped(), e.g. famid, validate and reorder.

Value

A ped object.

Examples

Run this code
# NOT RUN {
# Creating a trio where each parent have first cousin parents.
# (Alternatively, this could be built using many calls to addParents().)

# Paternal family
x = cousinPed(1, child = TRUE)
x = addSon(x, 9)

# Maternal family
y = cousinPed(1, child = TRUE)
y = relabel(y, c(101:108, 10))
y = swapSex(y, 10)

# Joining x and y at the common individuals (in this case: `10`)
z = mergePed(x, y)

# Plot all three pedigrees
opar = par(mfrow = c(1, 3))
plot(x); plot(y); plot(z, col = list(red = labels(y)))

# Reset graphical parameters
par(opar)

# }

Run the code above in your browser using DataLab