isMissing | R Documentation |
isMissing
returns Boolean values indicating whether the genotypes
for a given set of samples and loci are missing from the dataset.
isMissing(object, samples = Samples(object), loci = Loci(object))
object |
An object of one of the subclasses of |
samples |
A character or numeric vector indicating samples to be tested. |
loci |
A character or numeric vector indicating loci to be tested. |
isMissing
is a generic function with methods for genambig
and genbinary
objects.
For each genotype in a genambig
object, the function evaluates and returns
Genotype(object, sample, locus)[1] == Missing(object)
. For a
genbinary
object, TRUE %in% (Genotype(object, sample,
locus) == Missing(object))
is returned for the genotype. If only
one sample and locus are being evaluated, this is the Boolean value that
is returned. If multiple samples and/or loci are being evaluated, the
function creates an array of Boolean values and recursively calls itself
to fill in the result for each element of the array.
If both samples
and loci
are of length 1, a single
Boolean value is returned, TRUE
if the genotype is missing, and
FALSE
if it isn't. Otherwise, the function returns a named
array with samples in the first dimension and loci in the second
dimension, filled with Boolean values indicating whether the genotype
for each sample*locus combination is missing.
Lindsay V. Clark
Missing
, Missing<-
, Genotype
,
find.missing.gen
# set up a genambig object for this example mygen <- new("genambig", samples=c("a", "b"), loci=c("locD", "locE")) Genotypes(mygen) <- array(list(c(122, 126), c(124, 128, 134), Missing(mygen), c(156, 159)), dim=c(2,2)) viewGenotypes(mygen) # test if some individual genotypes are missing isMissing(mygen, "a", "locD") isMissing(mygen, "a", "locE") # test an array of genotypes isMissing(mygen, Samples(mygen), Loci(mygen))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.