#basic example
data.frame(ID=46:55,PK=c(rep("Treatment",5),rep("Placebo",5))) #before
data_shuffle(
data.frame(ID=46:55,PK=c(rep("Treatment",5),rep("Placebo",5)))
) #after shuffle row
data_shuffle(
data.frame(ID=46:55,PK=c(rep("Treatment",5),rep("Placebo",5))),
which = "cols"
) #after shuffle column
# examples using object
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
Run the code above in your browser using DataLab