deleteSamples | R Documentation |
These functions remove samples or loci from all relevant slots of an object.
deleteSamples(object, samples) deleteLoci(object, loci)
object |
An object containing the dataset of interest. Generally an object of
some subclass of |
samples |
A numerical or character vector of samples to be removed. |
loci |
A numerical or character vector of loci to be removed. |
These are generic functions with methods for genambig
,
genbinary
, and
gendata
objects. The methods for the subclasses remove samples
or loci
from the @Genotypes
slot, then pass the object to the method for
gendata
, which removes samples or loci from the @PopInfo
,
@Ploidies
, and/or @Usatnts
slots, as appropriate. The
@PopNames
slot is left untouched even if an entire population is
deleted, in order to preserve the connection between the numbers in
@PopInfo
and the names in @PopNames
.
If your intent is to experiment with excluding samples or loci, it may
be a better idea to create character vectors of samples and loci that
you want to use and then use these vectors as the samples
and
loci
arguments for analysis or export functions.
An object identical to object
, but with the specified samples or
loci removed.
These functions are somewhat redundant with the subscripting function
"["
, which also works for all gendata
objects. However,
they may be more convenient depending on whether the user prefers to
specify the samples and loci to use or to
exclude.
Lindsay V. Clark
Samples
, Loci
,
merge,gendata,gendata-method
# set up genambig object mygen <- new("genambig", samples = c("ind1", "ind2", "ind3", "ind4"), loci = c("locA", "locB", "locC", "locD")) # delete a sample Samples(mygen) mygen <- deleteSamples(mygen, "ind1") Samples(mygen) # delete some loci Loci(mygen) mygen <- deleteLoci(mygen, c("locB", "locC")) Loci(mygen)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.