filterKinMatrix: Filters a kinship matrix to include only the egos listed in...

Description Usage Arguments Value Examples

View source: R/filterKinMatrix.R

Description

Filters a kinship matrix to include only the egos listed in 'ids'

Usage

1
filterKinMatrix(ids, kmat)

Arguments

ids

character vector containing the IDs of interest. The kinship matrix should be reduced to only include these rows and columns.

kmat

a numeric matrix of pairwise kinship coefficients. Rows and columns should be named with IDs.

Value

A numeric matrix that is the reduced kinship matrix with named rows and columns (row and col names are 'ids').

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(nprcgenekeepr)
ped <- nprcgenekeepr::qcPed
ped$gen <- findGeneration(ped$id, ped$sire, ped$dam)
kmat <- kinship(ped$id, ped$sire, ped$dam, ped$gen,
                sparse = FALSE)
ids <- ped$id[c(189, 192, 194, 195)]
ncol(kmat)
nrow(kmat)
kmatFiltered <- filterKinMatrix(ids, kmat)
ncol(kmatFiltered)
nrow(kmatFiltered)

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