I have a vector of numbers and I would like to select some of them at random but in order. How could I do it?
For example:
vector <- runif(10, min=0, max=101)
vector
[1] 35.956732 67.608039 20.099881 23.184217 9.157408 34.105185 97.459770 25.805254 74.537667 18.865662
Which code can I use to create a new vector containing, for example, four out of the 10 values with the requirement that those four values are in the same order than the original vector? That is, the vector can not be 9.157408 67.608039 74.537667 97.459770
but 67.608039 9.157408 97.459770 74.537667
.
Any help would be great. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire