Learn R Programming

nprcgenekeepr (version 1.0.5)

makeRelationClassesTable: Make relation classes table from kin dataframe.

Description

From Relations

Usage

makeRelationClassesTable(kin)

Arguments

kin

a dataframe with columns id1, id2, kinship, and relation. It is a long-form table of pairwise kinships, with relationship categories included for each pair.

Value

A data.frame with the number of instances of following relationship classes: Parent-Offspring, Full-Siblings, Half-Siblings, Grandparent-Grandchild, Full-Cousins, Cousin - Other, Full-Avuncular, Avuncular - Other, Other, and No Relation.

Examples

Run this code
# NOT RUN {
library(nprcgenekeepr)
suppressMessages(library(dplyr))

qcPed <- nprcgenekeepr::qcPed
bkmat <- kinship(qcPed$id, qcPed$sire, qcPed$dam, qcPed$gen,
                 sparse = FALSE)
kin <- convertRelationships(bkmat, qcPed)
relClasses <- makeRelationClassesTable(kin)
relClasses$`Relationship Class` <-
   as.character(relClasses$`Relationship Class`)
relClassTbl <- kin[!kin$relation == "Self", ] %>%
  group_by(relation) %>%
  summarise(count = n())
relClassTbl
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab