samp | R Documentation |
Wrapper for stratified simple random sampling (SRS) and probability-proportional-to-size (PPS) sampling using permanent random numbers. Can also be used for non-stratified sampling using a dummy stratum taking the same value for each object.
samp(method, df, ...)
method |
|
df |
Data frame containing the elements to sample from. |
... |
Further method-specific arguments. |
Copy of the input data frame together with the boolean variable sampled
, as well as a numeric variable lambda
containing the estimated first-order inclusion probabilities when PPS is used.
srs
,
pps
,
transformprn
.
dfOut <- samp(method=pps,
df=ExampleData,
nsamp="nsample",
stratid="stratum",
prn="rands",
size="sizeM")
dfOut <- samp(method=srs,
df=ExampleData,
nsamp="nsample",
stratid="stratum",
prn="rands")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.