Remove Samples or Loci from an Object
These functions remove samples or loci from all relevant slots of an object.
deleteSamples(object, samples) deleteLoci(object, loci)
An object containing the dataset of interest. Generally an object of
some subclass of
A numerical or character vector of samples to be removed.
A numerical or character vector of loci to be removed.
These are generic functions with methods for
gendata objects. The methods for the subclasses remove samples
@Genotypes slot, then pass the object to the method for
gendata, which removes samples or loci from the
@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
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
loci arguments for analysis or export functions.
An object identical to
object, but with the specified samples or
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
Lindsay V. Clark
1 2 3 4 5 6 7 8 9 10 11 12 13
# 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)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.