data_shuffle {quickcode}R Documentation

Shuffle a data frame just like shuffle in PHP

Description

Shorthand to shuffle a data frame and save

Usage

data_shuffle(., which = c("rows", "cols"), seed = NULL)

Arguments

.

data to shuffle as data frame

which

what to shuffle, rows or columns

seed

apply seed if indicated for reproducibility

Value

shuffled data frame of items store to the data frame name

Examples

df1<-data.frame(ID=46:55,PK=c(rep("Treatment",5),rep("Placebo",5)))

#illustrate basic functionality
data_shuffle(df1)
df1 #shuffle and resaved to variable

data.f2<-df1
data_shuffle(data.f2)
data.f2 #first output

data.f2<-df1
data_shuffle(data.f2)
data.f2 # different output from first output top

data.f2<-df1
data_shuffle(data.f2,seed = 344L)
data.f2 #second output

data.f2<-df1
data_shuffle(data.f2,seed = 344L)
data.f2 #the same output as second output top


[Package quickcode version 0.8 Index]