Skip to contents

Takes a bootstrap sample from the population. A bootstrap sample is a sample taken with replacement having the same size of the population. See the Details section below for further information.

Usage

bootstrapSample(N, prob = NULL)

Arguments

N

positive integer value, the population size

prob

(optional) N-length vector of positive numeric values, the probability weights for obtaining the N elements

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)

#Random sample with replacement
bootstrapSample(N = 10)
#>  [1]  1  9 10  3  4  1  9  8  1  7