R/kinMatrix2LongForm.R
kinMatrix2LongForm.Rd
Part of Group Formation
kinMatrix2LongForm(kinMatrix, rm.dups = FALSE)
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) |
A dataframe with columns id1
, id2
, and kinship
.
This is the kinship data reformatted from a matrix, to a long-format table.
# \donttest{ 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)#> [1] 49#> [1] 28# }