Since a kinship matrix has subject ids in both rownames and colnames, so we need to remove rows and columns according to names in `id2keep`. We first remove rows and columns of subjects that are not in `id2keep`. We then order rows and columns of the resulting matrix by the ordering in `id2keep`.

subset_kinship(kinship, id2keep)

Arguments

kinship

a kinship matrix

id2keep

a character vector of subject ids to identify those subjects that are shared by all inputs