Hey I am very very new to R and would like to create a reverse raffle draw in R whereby a random sample of 1 variable is selected and removed from about 150 variables. The random sample would continually be generated and removed until the last variable remains (the winner)! Each time a sample is drawn, it would display and would be added to a new dataframe of generated or drawn numbers. (That way, either the remaining players in the raffle, or the list of 'losers' could be displayed). My eventual idea is to integrate the output into Tableau somehow as a means of displaying the results as the 'tickets' are drawn. But first things first - I saw the code below as a start - am i on the right track?
Random Samples *Use the sample( ) function to take a random sample of size n from a dataset. # take a random sample of size 50 from a dataset mydata # sample without replacement mysample <- mydata[sample(1:nrow(mydata), 50, replace=FALSE),]
Any ideas?
Aucun commentaire:
Enregistrer un commentaire