Learn R Programming

predhy (version 2.1.2)

kin: Calculate Kinship Matrix

Description

Calculate the additive and dominance kinship matrix.

Usage

kin(gen)

Value

a kinship matrix

Arguments

gen

a matrix for genotypes, coded as 1, 0, -1 for AA, Aa, aa. Each row represents an individual and each column represents a marker.

Examples

Run this code
## random population with 100 lines and 1000 markers
gen <- matrix(rep(0,100*1000),100,1000)
gen <- apply(gen,2,function(x){x <- sample(c(-1,0,1), 100, replace = TRUE)})

## generate 100*100 kinship matrix
k <- kin(gen)

Run the code above in your browser using DataLab