group.diversity: Boxplot To Compare Diversity Indices Among Groups

Description Usage Arguments Value Author(s) See Also Examples

Description

This function first use OTU.diversity to calculate the diversity indices for each sample and then do a boxplot to compare the selected indices among different groups.

Usage

1
2
3
4
5
6
7
8
group.diversity(data, meta, factors="", indices="",
                diversity.info=FALSE,
                x.axis=NULL, compare=NULL,
                facet=NULL, facet.y=TRUE, facet.x.cex=NULL,
                facet.y.cex=NULL, scale.free=NULL,
                xlab=NULL, ylab=NULL,
                legend.title=NULL, legend.labels=NULL,
                file=NULL, ext=NULL, width=8, height=8)

Arguments

data

a list, containing otu tables. See also RAM.input.formatting

meta

the metadata table to be used (must have same samples as data.

factors

a character vector. Must be variables in the metadata

indices

a character vector. Must be one or more of the following: "spec", "sim", "invsim", "shan", "sim_even", "shan_even", "sim_trudiv", "shan_trudiv", "chao", "ACE". See also OTU.diversity, true.diversity, evenness, and diversity.

diversity.info

logical. Whether the diversity indices have calculated and included in the metadata table. The diversity indices should be processed by OTU.diversity for the same otu tables and metadata table.

x.axis

optional. If NULL, will use the first variable in factors; otherwise, must be one factor in the metadata or 'SampleID'

compare

optional. If NULL, will use the first variable in factors; otherwise, must be one factor in the metadata

facet

optional. If provided, must be one factor in the metadata or 'SampleID'

facet.y

logical, whether the facet being used as strip text of y axis or x axis.

facet.x.cex

optional, an integer, the font size of the stip.text.x in ggplot

facet.y.cex

optional, an integer, the font size of the strip.text.y in ggplot.

scale.free

optional. Whether use free scale for y axis.

xlab

optional. If not provided, the x.axis will be used as the title of the x axis, otherwise, will use the provided string.

ylab

optional. If not provided, "value" will be used as the title of the y axis, otherwise, will use the provided string.

legend.title

optional. If not provided, compare will be used as the title of the legend, otherwise, will use the provided string.

legend.labels

optional. If not provided, will use the levels of compare for the legends, otherwise, will use the provided vector of strings. The length of the provided vector of strings must equals to the levels of compare.

file

the filename to save the plot.

ext

the extention (file type) of the plot to saved.

width

the width of the plot to be saved.

height

the heigth of the plot to be saved.

Value

This function returns a boxplot to compared selected diversity indices among different groups.

Author(s)

Wen Chen.

See Also

OTU.diversity, true.diversity, evenness and diversity

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(ITS1, ITS2, meta)
## Not run: 
RAM.theme<-RAM.color()
group.diversity(data=list(ITS1=ITS1, ITS2=ITS2), meta=meta,
                factors=c("Crop", "City"),
                indices=c("sim_trudiv", "shan_trudiv"),
                x.axis="Crop", compare="Harvestmethod",
                facet="City", facet.y=FALSE) + RAM.theme

## End(Not run)

Example output

Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-4
Loading required package: ggplot2
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
Warning messages:
1: `axis.ticks.margin` is deprecated. Please set `margin` property  of `axis.text` instead 
2: `panel.margin` is deprecated. Please use `panel.spacing` property instead 
Using City, Crop, Harvestmethod, SampleID as id variables

RAM documentation built on May 2, 2019, 3:04 p.m.