[R] How can I generate a random order?

From: Stuart Leask <Stuart.Leask_at_nottingham.ac.uk>
Date: Wed, 12 Nov 2008 20:24:14 +0000

Feeling very stupid here.

I just want to randomly-ordered some integers, e.g. the numbers 1 to 100, with each element present once only in a random order. I suspect I need to randomly sample a population 1-100, remove that number, then randomly sample what is left until they've all gone, but I can't seem to find the right combination of order/sort/sample + runif.

I fear it can't be that hard - has anyone cracked this?


Dr Stuart J Leask DM MRCPsych MA BChir
Clinical Senior Lecturer and Honorary Consultant in Clinical Psychiatry University Dept of Psychiatry, A Floor, Queen's Medical Centre, Nottingham. NG7 2UH
www: Google "Dr Stuart Leask"  

This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 12 Nov 2008 - 20:27:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Nov 2008 - 21:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive