Learn R Programming

polysat (version 0.1)

find.missing.gen: Find Missing Genotypes

Description

This function returns a data frame listing the locus and sample names of all genotypes with missing data.

Usage

find.missing.gen(gendata, missing = -9, samples =
  dimnames(gendata)[[1]], loci = dimnames(gendata)[[2]])

Arguments

gendata
A genotype object in the standard polysat format. A two dimensional list of vectors, where samples are represented and named in the first dimension and loci in the second dimension. Each vector contains all unique alleles for a given sample and locus
missing
The symbol used to indicate missing data.
samples
A character vector of all samples to be searched. Must be a subset of dimnames(gendata)[[1]].
loci
A character vector of all loci to be searched. Must be a subset of dimnames(gendata)[[2]].

Value

  • A data frame with no row names. The first column is named Locus and the second column is named Sample. Each row represents one missing genotype, and gives the locus and sample of that genotype.

Examples

Run this code
# set up the genotype data
samples <- paste("ind", 1:4, sep="")
samples
loci <- paste("loc", 1:3, sep="")
loci
testgen <- array(list(-9), dim = c(4,3), dimnames = list(samples,loci))
testgen[,"loc1"] <- list(c(-9), c(102,104), c(100,106,108,110,114),
                         c(102,104,106,110,112))
testgen[,"loc2"] <- list(c(77,79,83), c(79,85), c(-9), c(83,85,87,91))
testgen[,"loc3"] <- list(c(122,128), c(124,126,128,132), c(120,126),
                         c(124,128,130))

# look up which samples*loci have missing genotypes
find.missing.gen(testgen)

Run the code above in your browser using DataLab