Learn R Programming

preseqR (version 4.0.0)

preseqR.nonreplace.sampling: Sampling

Description

Generating a histogram by subsampling without replacement.

Usage

preseqR.nonreplace.sampling(n, size)

Arguments

n

A two-column matrix. The first column is the frequency \(j = 1,2,\dots\); and the second column is \(N_j\), the number of species represented exactly \(j\) times in the initial sample. The first column must be sorted in an ascending order.

size

An positive integer representing the size of the subsample.

Value

A two-column matrix as a subsample. The first column is the frequency \(j = 1,2,\dots\); and the second column is \(N_j\), the number of species represented \(j\) times in the subsample.

Details

preseqR.nonreplace.sampling generates a subsample by sampling the initial sample without replacement. sample in \(R\) is used to implement the function. We wrap up this function in such a way that both the input and the output are histograms.

References

https://stat.ethz.ch/R-manual/R-patched/library/base/html/sample.html

Examples

Run this code
# NOT RUN {
## load library
library(preseqR)
## import data
data(FisherButterfly)
## generate a subsample of size 1000.
preseqR.nonreplace.sampling(n=FisherButterfly, size=1000)
# }

Run the code above in your browser using DataLab