kinMatrix2LongForm: Reformats a kinship matrix into a long-format table.

Description Usage Arguments Value Examples

View source: R/kinMatrix2LongForm.R

Description

Part of Group Formation

Usage

1
kinMatrix2LongForm(kinMatrix, rm.dups = FALSE)

Arguments

kinMatrix

numerical matrix of pairwise kinship values. The row and column names correspond to animal IDs.

rm.dups

logical value indication whether or not reverse-order ID pairs be filtered out? (i.e., "ID1 ID2 kin_val" and "ID2 ID1 kin_val" will be collapsed into a single entry if rm.dups = TRUE)

Value

A dataframe with columns id1, id2, and kinship. This is the kinship data reformatted from a matrix, to a long-format table.

Examples

1
2
3
4
5
6
7
8
library(nprcgenekeepr)
ped <- nprcgenekeepr::lacy1989Ped
ped$gen <- findGeneration(ped$id, ped$sire, ped$dam)
kmat <- kinship(ped$id, ped$sire, ped$dam, ped$gen)
reformattedKmat <- kinMatrix2LongForm(kmat, rm.dups = FALSE)
nrow(reformattedKmat)
reformattedNoDupsKmat <- kinMatrix2LongForm(kmat, rm.dups = TRUE)
nrow(reformattedNoDupsKmat)

rmsharp/nprcmanager documentation built on April 24, 2021, 3:13 p.m.