Learn R Programming

RAM (version 1.2.1.3)

factor.abundance: Plot the Abundance of OTUs by Classification at a Given Taxonomic Rank For Each Level of A Metadata Category Variable.

Description

This function consumes an OTU, and a rank, as well as various optional parameters. It creates a stacked bar plot showing the abundance of all classifications at the given taxonomic rank for each level of a metadata category variable.

Usage

factor.abundance(data, rank, top=NULL, count=FALSE, meta=meta, meta.factor="", drop.unclassified=FALSE, file=NULL, ext=NULL, height=8, width=16, main="")

Arguments

data
a list of OTU tables with names.
rank
the taxonomic rank to use. See RAM.rank.formatting.
top
the number of groups to select, starting with the most abundant. If NULL, all are selected.
count
logical. If TRUE, the numerical counts for each OTU will be shown; otherwise the relative abundance will be shown.
meta
metadata.
meta.factor
a category variable in metadata
drop.unclassified
logical. Should unclassified samples be excluded from the data?
file
the file path where the image should be created (see ?RAM.plotting).
ext
the file type to be used; one of "pdf", "png", "tiff", "bmp", "jpg", or "svg".
height
the height of the image to be created (in inches).
width
the width of the image to be created (in inches).
main
the title of the plot

Examples

Run this code
data(ITS1, ITS2, meta)
data=list(ITS1=ITS1, ITS2=ITS2)
# plot the relative abundance at the class level to the screen,
# ignoring the unclassified
factor.abundance(data=data, rank="family", meta=meta,
                 meta.factor=c("Crop"), top=20,
                 drop.unclassified=TRUE)
## Not run: 
# # plot the count abundance at the phylum level to path.tiff
# factor.abundance(data=data, rank="family", meta=meta,
#                  meta.factor=c("Crop"), top=20, count=FALSE,
#                  drop.unclassified=TRUE, main="",
#                  file="path/to/tiff", ext="tiff", 
#                  height=8, width=12)
# ## End(Not run)

Run the code above in your browser using DataLab