sorted_sample: Draw sorted sample.

Description Usage Arguments Details Value Author(s) Examples

Description

Draw a sorted random sample from a vector, conserving the original order of the elements.

Usage

1
sorted_sample(x, size, replace = FALSE, prob = NULL)

Arguments

x

either a vector of one or more elements from which to choose, or a positive integer. See ‘Details.’

size

a non-negative integer giving the number of items to choose.

replace

should sampling be with replacement?

prob

a vector of probability weights for obtaining the elements of the vector being sampled.

Details

Note that the sample is not actually sorted, but reorder by matching it back with match to the original vector.

Value

A vector with the sample according to the original order.

Author(s)

Dominik Mueller

Examples

1
2
3

DominikMueller64/dmisc documentation built on May 6, 2019, 2:52 p.m.