# divsubsamples

### Description

Function to generate the rarefaction data from a given sample

### Usage

1 2 | ```
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 |

`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 Laydon, Aaron Sim, Charles Bangham, Becca Asquith

### 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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
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)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.