Learn R Programming

RAM (version 1.2.1.3)

tax.split: Split OTU Tables By Taxonomic Rank

Description

This function consumes an OTU table and splits its taxonomy columns into the seven major taxonomic ranks. It returns a data frame preserving all numerical data, but changing the 'taxonomy' column to the name of the appropriate rank, and preserving only the classifications at that rank.

Usage

tax.split(otu1, otu2 = NULL, rank = NULL)

Arguments

otu1
the first OTU table to be used.
otu2
the second OTU table to be used.
rank
the (optional) rank to split at and return (see ?RAM.rank.formatting for formatting details).

Value

The value returned by this function may become nested lists, so for convenience, any nested lists have been given descriptive items names to make accessing its elements simple (see Examples).
  • If otu2 is given:
    • If rank is given: a list containing two data frames (otu1 and otu2 split at the given rank).
    • If rank is not given: a list containing two lists. The first sublist represents otu1, the second otu2. The sublists contain seven data frames, which are the data split at each taxonomic rank (see Examples).
  • If otu2 is not given:
    • If rank is given: a single data frame (otu1 split at the given rank).
    • If rank is not given: a list containing seven data frames (otu1 split at each taxonomic rank).

See Also

get.rank

Examples

Run this code
data(ITS1, ITS2)
# split only ITS1 data at a single rank
ITS1.tax.p <- tax.split(ITS1, rank="phylum")
# split only ITS1 data at all ranks
ITS1.tax.all <- tax.split(ITS1)
# split ITS1 and IST2 data at a given rank
lst <- tax.split(ITS1, ITS2, rank="c")
# split ITS1 and ITS2 at every rank
lst.all <- tax.split(ITS1, ITS2)
stopifnot(identical(lst.all$otu1$phylum, ITS1.tax.p))

Run the code above in your browser using DataLab