mardi 8 janvier 2019

Creating shuffled numbers in R

As a result of seeing THIS EXAMPLE, I was wondering how I could create one set of 40 shuffled orderings of 1 through 4 in R?

To be clear, I'm not looking for replicate(40, sample(1:4, 4)) because that gives me 40 separate sets each consisting of 4 shuffled numbers.

I could use sample(1:4, 40, replace = TRUE) but that doesn't guarantee that all members of 1 through 4 will be ALWAYS picked, thus it's not the same as shuffling.




Aucun commentaire:

Enregistrer un commentaire