shuffle: Shuffle rows or elements of a data object

Description Usage Arguments Examples

Description

Randomly shuffle the rows/elements of an object. If x is a matrix or data frame, this is equivalent to draw(x, n = nrow(x)) or x[sample(1:nrow(x), size = nrow(x)), ].

Usage

1

Arguments

x

An object

Examples

1
2
3
4
5
6
7
8
9
set.seed(4321)
head(shuffle(iris))
# Sepal.Length Sepal.Width Petal.Length Petal.Width    Species
# 51           7.0         3.2          4.7         1.4 versicolor
# 136          7.7         3.0          6.1         2.3  virginica
# 61           5.0         2.0          3.5         1.0 versicolor
# 7            4.6         3.4          1.4         0.3     setosa
# 112          6.4         2.7          5.3         1.9  virginica
# 109          6.7         2.5          5.8         1.8  virginica

Thie1e/convenience documentation built on May 9, 2019, 4:40 p.m.