Learn R Programming

TRAMPR (version 1.0-10)

combine.TRAMPsamples: Combine TRAMPsamples Objects

Description

Combines two TRAMPsamples objects into one large TRAMPsamples object containing all the samples for both original objects.

Usage

# S3 method for TRAMPsamples
combine(x, y, rewrite.sample.pk=FALSE, ...)

Arguments

x, y

TRAMPsamples objects, containing TRFLP patterns.

rewrite.sample.pk

Logical: If the new sample data (y) contains sample.pk values that conflict with those in the original TRAMPsamples object (x), should the new samples be renumbered? If this is TRUE, do not rely on any sample.pk values staying the same for the newly added samples. sample.pk values in the original TRAMPsamples object will never be changed.

...

Further arguments passed to or from other methods.

Details

For a discussion of rewrite.sample.pk, see the comments on rewrite.knowns.pk in the Details of combine.TRAMPknowns.

The data and info elements of the resulting TRAMPsamples object will have union of the columns present in both sets of samples.

If any additional elements exist as part of the second TRAMPsamples object (e.g. passed as ... to TRAMPsamples), these will be ignored with a warning (see Example).

See Also

combine.TRAMPknowns, the method for TRAMPknowns objects.

Examples

Run this code
# NOT RUN {
data(demo.samples)

## Let's split the original samples database in two, and recombine.
demo.samples.a <- demo.samples[head(labels(demo.samples), 10)]
demo.samples.b <- demo.samples[tail(labels(demo.samples), 10)]

## Combining these is easy:
demo.samples.c <- combine.TRAMPsamples(demo.samples.a, demo.samples.b)

## There is a warning message because demo.samples.b contains extra
## elements:
names(demo.samples.b)

## In this case, these objects should not be combined, but in other
## cases it may be necessary to rbind() the extra objects together:
# }
# NOT RUN {
demo.samples.c$soilcore <- rbind(demo.samples.a$soilcore,
                                 demo.samples.b$soilcore)
# }
# NOT RUN {
## This must be done manually, since there is no way of telling what
## should be done automatically.  Ideas/contributions are welcome here.
# }

Run the code above in your browser using DataLab