Learn R Programming

RAM (version 1.2.1.3)

data.subset: Subset OTU And Metadata

Description

This function subset OTUs and metadata based on user defined values of metadata variables.

Usage

data.subset(data, meta, factors="", values="", and=TRUE)

Arguments

data
a list of otu tables to be processed. See also RAM.input.formatting.
meta
the metadata for subset.
factors
a vector containing metadata variables.
values
a vector containing values of interest in metadata variables.
and
logical. Determine whether all conditions needs to be met or not.

Value

The value returned by this function is a list containing otu tables matching the filtering requirement. The last item in the output list is the associated new metadata table fit the requirement.

Examples

Run this code
data(ITS1, ITS2, meta)
names(meta)
factors <- c("City", "Harvestmethod")
values <- c("City1", "Method1")
# match all requirements, and=TRUE
sub <- data.subset(data=list(ITS1=ITS1, ITS2=ITS2), meta=meta,
                   factors=factors, values=values, and=TRUE)
# match either of the requirements, and=FALSE
sub <- data.subset(data=list(ITS1=ITS1, ITS2=ITS2), meta=meta,
                   factors=factors, values=values, and=FALSE)
## Not run: 
# names(sub)
# ITS1.sub <- sub[["ITS1"]]
# ITS2.sub <- sub[["ITS2"]]
# meta.sub <- sub[["meta"]]
# ## End(Not run)

Run the code above in your browser using DataLab