check_data: Checks the data for consistency with the inbreedR working...

Description Usage Arguments Details Value Author(s) Examples

View source: R/check_data.R

Description

The inbreedR working format is an i * l genotype matrix, whereby each individual is a row and each column is a locus. Heterozygosity at a given locus should be coded as 1, homozygosity as 0 and missing values should be coded as NA.

Usage

1
check_data(genotypes, num_ind = NULL, num_loci = NULL)

Arguments

genotypes

data.frame (or matrix) with individuals in rows and loci in columns, containing genotypes coded as 0 (homozygote), 1 (heterozygote) and NA (missing)

num_ind

Number of individuals

num_loci

Number of loci / markers

Details

Checks that (1) the genotype data just contains 3 elements, which is 0 for homozygote, 1 for heterozygote and NA for missing data, (2) the number of individuals corresponds to the number of rows and the number of loci corresponds to the number of columns, (3) the data type is numeric. .

Value

TRUE if the data format is correct, error message if any test failed

Author(s)

Martin A. Stoffel (martin.adam.stoffel@gmail.com)

Examples

1
2
3
4
5
data(mouse_msats)
# tranform raw genotypes into 0/1 format
genotypes <- convert_raw(mouse_msats)
# check data
check_data(genotypes, num_ind = 36, num_loci = 12)

inbreedR documentation built on Feb. 2, 2022, 5:09 p.m.