Skip to contents

Takes a simple random sample without replacement from the population. Simple random sampling (SRS) is the easiest form of sampling where each element of the population has the same probability of being selected for the sample. See the Details section below for further information.

Usage

simpleRandomSampleWithoutReplacement(N, n)

Arguments

N

positive integer value, the population size

n

positive integer value, the sample size

Value

A vector of length n containing the index of the computed random set of observations.

Details

This function is a wrapper to the sample.int function.

Author

Alessandro Barberis

Examples

#Set seed for reproducibility
set.seed(seed = 5381L)

#Simple random sample without replacement
simpleRandomSampleWithoutReplacement(N = 10, n = 5)
#> [1] 1 9 7 2 4