[R] How can I generate a random order?

Stuart Leask Stuart.Leask at nottingham.ac.uk
Wed Nov 12 21:24:14 CET 2008

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.

More information about the R-help mailing list