merge-methods | R Documentation |
The generic function merge
has methods defined in polysat to
merge two genotype objects of the same class. Each method has optional
samples
and loci
arguments for specifying subsets of
samples and loci to be included in the merged object. Each method also
has an optional overwrite
argument to specify which of the two
objects should not be used in the case of conflicting data.
merge(x, y, ...)
x |
One of the objects to be merged. For the methods defined for
polysat this should be of class |
y |
The other object to be merged. Should be of the same class as
|
... |
Additional arguments specific to the method. |
The methods for merge
in polysat have four additional
arguments: objectm, samples, loci, overwrite
.
The samples
and loci
arguments can specify, using
character vectors, a subset of the samples and loci found in
x
and y
to write to the object that is returned.
If overwrite = "x"
, data from the second object will be used
wherever there is contradicting data. Likewise if overwrite =
"y"
, data from the first object will be used wherever there is
contradicting data. If no overwrite
argument is given, then
any contradicting data between the two objects will produce an error
indicating where the contradicting data were found.
The objectm
argument is primarily for internal use (most
users will not need it). If this argument is not
provided, a new genotype object is created and data from x
and y
are written to it. If objectm
is
provided, this is the object to which data will be written, and the
object that will be returned.
signature(x = "genambig", y = "genambig")
This method merges the genotype data from x
and y
. If the
missing data symbols differ between the objects, overwrite
is
used to determine which missing data symbol to use, and all missing data
symbols in the overwritten object are converted. If overwrite
is
not provided and the missing data symbols differ between the objects, an
error will be given. The genotypes are then filled in. If certain
sample*locus combinations do not exist in either object (x
and
y
have different samples as well as different loci), missing data
symbols are left in these positions. Again, for genotypes,
overwrite
determines which object to preferentially use for data
and whether to give an error if there is a disagreement.
The merge
method for gendata
is then called.
signature(x = "genbinary", y = "genbinary")
This method also merges genotype data for x
and y
, then
calls the method for gendata
. Missing
, Present
,
and Absent
are checked for consistency between objects similarly
to what happens with Missing
in the genambig
method.
Genotypes are then written to the merged object, and consistency between
genotypes is checked.
signature(x = "gendata", y = "gendata")
This method merges data about ploidy, repeat length, and population identity, as well as writing one or both dataset descriptions to the merged object.
The same population numbers can have different meanings in
PopInfo(x)
and PopInfo(y)
. The unique PopNames
are
used instead to determine population identity, and the PopInfo
numbers are changed if necessary. Therefore, it is important for
identical populations to be named the same way in both objects, but not
important for identical populations to have the same number in both objects.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.