Learn R Programming

DivE (version 1.0)

divsubsamples: divsubsamples

Description

Function to generate the rarefaction data from a given sample

Usage

divsubsamples(mainsamp, nrf, minrarefac=1, maxrarefac=length(format.input(mainsamp)), NResamples=1000)

Arguments

mainsamp
the main sample, either as a 2-column data.frame (species ID, count of species), or a vector of species IDs.
nrf
difference between lengths of successive rarefaction datapoints.
minrarefac
minimum rarefaction data x-axis value. Default is 1.
maxrarefac
maximum rarefaction data x-axis value. Default is length of the sample mainsamp.
NResamples
number of resamples used to calculate the rarefaction data.

Value

a list of class divsubsamples containing resampling results (i.e. the diversity data). This includes the following:
RarefacXAxis
vector of x-axis rarefaction data
RarefacYAxis
vector of y-axis rarefaction data
div_sd
vector of y-axis rarefaction data standard deviations
NResamples
number of sampling iterations used to calculate sample means of each subsample diversity

Details

This function produces a vector of subsamples diversity values with subsample lengths evenly distributed between a specified minimum and maximum number. The curvature of the rarefaction curve can be obtained with the function Curvature.

References

Laydon, D., Melamed, A., Sim, A., Gillet, N. A., Sim, K., Darko, S., Kroll, S., Douek, D. C., Price, D., Bangham, C. R. M., Asquith, B., Quantification of HTLV-1 clonality and TCR diversity, PLOS Comput. Biol. 2014

Examples

Run this code
require(DivE)
data(Bact1)

dss_1 <- divsubsamples(Bact1, nrf=2, minrarefac=1, maxrarefac=100,
                        NResamples=10) 
dss_2 <- divsubsamples(Bact1, nrf=20, minrarefac=1, maxrarefac=100,
                        NResamples=10)
# Default NResamples=1000; low value of NResamples=10 is a set for quick evaluation

dss_1
dss_2

summary(dss_1)
dss_1$div_sd
dss_1$NResamples

Curvature(dss_1)

Run the code above in your browser using DataLab