kin
dataframe.R/makeRelationsClassesTable.R
makeRelationClassesTable.Rd
From Relations
makeRelationClassesTable(kin)
kin | a dataframe with columns |
---|
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.
# \donttest{ 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#> # A tibble: 10 x 2 #> relation count #> <chr> <int> #> 1 Avuncular - Other 117 #> 2 Cousin - Other 51 #> 3 Full-Avuncular 9 #> 4 Full-Cousins 5 #> 5 Full-Siblings 3 #> 6 Grandparent-Grandchild 301 #> 7 Half-Siblings 105 #> 8 No Relation 37531 #> 9 Other 626 #> 10 Parent-Offspring 312# }