polysat (version 1.7-4)

deleteSamples: Remove Samples or Loci from an Object

Description

These functions remove samples or loci from all relevant slots of an object.

Usage

deleteSamples(object, samples)
deleteLoci(object, loci)

Arguments

object

An object containing the dataset of interest. Generally an object of some subclass of gendata.

samples

A numerical or character vector of samples to be removed.

loci

A numerical or character vector of loci to be removed.

Value

An object identical to object, but with the specified samples or loci removed.

Details

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.

See Also

Samples, Loci, merge,gendata,gendata-method

Examples

Run this code
# NOT RUN {
# 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)
# }

Run the code above in your browser using DataCamp Workspace