Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

shuffle

Safe Version of Sample


Description

A version of sample() which does not treat positive scalar integer x differently. See example.

Usage

shuffle(x, n = length(x), ...)

Arguments

x

(vector())
Vector to sample elements from.

n

(integer())
Number of elements to sample.

...

(any)
Arguments passed down to base::sample.int().

Examples

x = 2:3
sample(x)
shuffle(x)

x = 3
sample(x)
shuffle(x)

mlr3misc

Helper Functions for 'mlr3'

v0.10.0
LGPL-3
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Patrick Schratz [aut] (<https://orcid.org/0000-0003-0748-6624>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.