Learn R Programming

sequoia (version 1.3.3)

GetRelCat: Pairwise relationship

Description

Determine the relationship between individual X and all other individuals in the pedigree, going up to 1 or 2 generations back.

Usage

GetRelCat(x, Ped, GenBack = 2)

Arguments

x

The focal individual, either its rownumber in the pedigreee or ID.

Ped

dataframe with pedigree; columns id - dam - sire.

GenBack

Number of generations back to consider; 1 returns parent-offspring and sibling relationships, 2 also returns grandparental, avuncular and first cousins.

Value

A named vector of length equal to the number of rows in Ped, with for each ID its relationship to the focal individual:

S

Self

M

Mother

P

Father

O

Offspring

FS

Full sibling

MHS

Maternal half-sibling

PHS

Paternal half-sibling

MGM

Maternal grandmother

MGF

Maternal grandfather

PGM

Paternal grandmother

PGF

Paternal grandfather

GO

Grand-offspring

FA

Full avuncular; maternal or paternal aunt or uncle

HA

Half avuncular

FN

Full nephew/niece

HN

Half nephew/niece

FC1

Full first cousin

DFC1

Double full first cousin

U

Unrelated (or otherwise related)

Details

if

Examples

Run this code
# NOT RUN {
# make NxN matrix with relationship categories:
RCM <- sapply(1:nrow(Ped), GetRelCat, Ped)
# table is considerably faster on a factor than a character vector:
table(factor(RCM, levels=c("M","P","FS","MHS","PHS","MGM")))
# note that sibling & cousin pairs are counted twice!
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab