divsubsamples: DivSubsamples

DivSubsamplesR Documentation

DivSubsamples

Description

Function to generate the rarefaction data from a given sample

Usage

DivSubsamples(mainsamp, nrf, minrarefac=1,
maxrarefac=length(FormatInput(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.

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.

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

Author(s)

Daniel J. Laydon, Aaron Sim, Charles R.M. Bangham, Becca Asquith

References

Laydon, D. J., 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

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)

DivE documentation built on Oct. 14, 2023, 5:08 p.m.