View source: R/vector_shuffle.R
vector_shuffle | R Documentation |
Shorthand to shuffle a vector and save
vector_shuffle(., replace = FALSE, prob = NULL, seed = NULL)
. |
vector to shuffle |
replace |
replace selected value |
prob |
probability of occurrence |
seed |
apply seed if indicated for reproducibility |
shuffled vector of items store to the vector name
#basic example
vector_shuffle(c(3,45,23,3,2,4,1))
#using objects
v1<-c(3,45,23,3,2,4,1)
#demonstrate vector_shuffle
vector_shuffle(v1)
v1 # show outputs
#demonstrate reproducibility in shuffle with seed
v0<-v1
vector_shuffle(v0)
v0 #first output
v0<-v1
vector_shuffle(v0)
v0 # different output from first output top
v0<-v1
vector_shuffle(v0,seed = 232L)
v0 #second output
v0<-v1
vector_shuffle(v0,seed = 232L)
v0 #the same output as second output top
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.