1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/shuffle.R
3\name{step_shuffle}
4\alias{step_shuffle}
5\title{Shuffle Variables}
6\usage{
7step_shuffle(
8  recipe,
9  ...,
10  role = NA,
11  trained = FALSE,
12  columns = NULL,
13  skip = FALSE,
14  id = rand_id("shuffle")
15)
16}
17\arguments{
18\item{recipe}{A recipe object. The step will be added to the
19sequence of operations for this recipe.}
20
21\item{...}{One or more selector functions to choose variables
22for this step. See \code{\link[=selections]{selections()}} for more details.}
23
24\item{role}{Not used by this step since no new variables are
25created.}
26
27\item{trained}{A logical to indicate if the quantities for
28preprocessing have been estimated.}
29
30\item{columns}{A character string that contains the names of
31columns that should be shuffled. These values are not determined
32until \code{\link[=prep.recipe]{prep.recipe()}} is called.}
33
34\item{skip}{A logical. Should the step be skipped when the
35recipe is baked by \code{\link[=bake.recipe]{bake.recipe()}}? While all operations are baked
36when \code{\link[=prep.recipe]{prep.recipe()}} is run, some operations may not be able to be
37conducted on new data (e.g. processing the outcome variable(s)).
38Care should be taken when using \code{skip = TRUE} as it may affect
39the computations for subsequent operations.}
40
41\item{id}{A character string that is unique to this step to identify it.}
42}
43\value{
44An updated version of \code{recipe} with the new step added to the
45sequence of any existing operations.
46}
47\description{
48\code{step_shuffle} creates a \emph{specification} of a recipe
49step that will randomly change the order of rows for selected
50variables.
51}
52\details{
53When you \code{\link[=tidy]{tidy()}} this step, a tibble with column \code{terms} (the
54columns that will be permuted) is returned.
55}
56\examples{
57integers <- data.frame(A = 1:12, B = 13:24, C = 25:36)
58
59library(dplyr)
60rec <- recipe(~ A + B + C, data = integers) \%>\%
61  step_shuffle(A, B)
62
63rand_set <- prep(rec, training = integers)
64
65set.seed(5377)
66bake(rand_set, integers)
67
68tidy(rec, number = 1)
69tidy(rand_set, number = 1)
70}
71\seealso{
72Other row operation steps:
73\code{\link{step_arrange}()},
74\code{\link{step_filter}()},
75\code{\link{step_impute_roll}()},
76\code{\link{step_lag}()},
77\code{\link{step_naomit}()},
78\code{\link{step_sample}()},
79\code{\link{step_slice}()}
80}
81\concept{row operation steps}
82