Function to sample after sorting:

sampleSorted(x, size, seed, replace = TRUE, sorted = TRUE, index.out = FALSE)

Arguments

x

The vector to sample from.

size

The length of the sampled vector.

seed

The seed to use for the sampling.

replace

Logical: If TRUE sample with replacement.

sorted

Sort the vector before sampling.

index.out

Return indices at which to sample rather than the actual samples.