Learn R Programming

sampling (version 0.45)

srswr: Simple random sampling with replacement

Description

Draws a simple random sampling with replacement of size $n$ (equal probabilities, fixed sample size, with replacement).

Usage

srswr(n,N)

Arguments

n
sample size.
N
population size.

Details

Returns a vector of size N, population size. Each element k of this vector indicates the number of replicates for unit k in the sample.

See Also

rmultinom, UPmultinomial

Examples

Run this code
s=srswr(3,10)
#the selected units are 
(1:10)[s!=0]
#wiht the number of replicates 
s[s!=0]

Run the code above in your browser using DataLab