srs: Stratified simple random sampling

View source: R/srs.R

srsR Documentation

Stratified simple random sampling

Description

Stratified simple random sampling (SRS) using permanent random numbers. Can also be used for non-stratified SRS using a dummy stratum taking the same value for each object.

Usage

srs(frame, stratid, nsamp, prn)

Arguments

frame

Data frame (or data.table or tibble) containing the elements to sample from.

stratid

Variable in frame containing the strata.

nsamp

Variable in frame containing the sample sizes.

prn

Variable in frame containing the permanent random numbers.

Value

A copy of the input sampling frame together with the boolean variable sampled, indicating sample inclusion.

See Also

prnsamplr, samp, pps, transformprn, ExampleData

Examples

dfOut <- srs(
  frame = ExampleData,
  nsamp = ~nsample,
  stratid = ~stratum,
  prn = ~rands
)

prnsamplr documentation built on April 3, 2025, 7:35 p.m.