All unique samples from a data set in R -


here's data

z<- c("cop","chk","bp","bhi","cvx") 

if do

 sample(z,3,replace=false) 

this give me 1 unique random sample of 3 data set.

i want find possible unique samples of 3 data set. in case there 10 outcomes.

but how write r code it?

please help

we can use combn unique combinations

t(combn(z, 3)) 

if need sample it

t(combn(sample(z), 3)) 

Comments