| sampling {simFrame} | R Documentation |
Functions for random sampling.
srs(N, size, replace = FALSE) ups(N, size, prob, replace = FALSE)
N |
a non-negative integer giving the number of observations from which to sample. |
size |
a non-negative integer giving the number of observations to sample. |
prob |
a numeric vector giving the probability weights. |
replace |
a logical indicating whether sampling should be performed with or without replacement. |
srs and ups are wrappers for simple random sampling and
unequal probability sampling, respectively. Both functions make use of
sample.
An integer vector giving the indices of the sampled observations.
Andreas Alfons, alfons@statistik.tuwien.ac.at
## simple random sampling without replacement srs(10, 5) ## simple random sampling with replacement srs(5, 10, replace = TRUE) ## unequal probability sampling without replacement ups(10, 5, prob = 1:10) ## unequal probability sampling with replacement ups(5, 10, prob = 1:5, replace = TRUE)