s-news
[Top] [All Lists]

Random "shuffling" of a dataframe based on a column

To: <s-news@lists.biostat.wustl.edu>
Subject: Random "shuffling" of a dataframe based on a column
From: "Khan, Sohail" <khan@cshl.edu>
Date: Tue, 26 Jul 2005 10:48:58 -0400
Thread-index: AcWR8RSPWVmZ/oEiSBiY+gpoLQJ5hw==
Thread-topic: Random "shuffling" of a dataframe based on a column
Dear List,

Is there a way to "shuffle" a data frame based on a column.  I.E. if the data 
frame looks like:
pos    ratio
1       0.2356
2       0.5236
3       1.2356
4       2.5690

I would like to randomly shuffle based on column pos so data frame looks like:

pos    ratio
3       1.2356
1       0.2356
4       2.5690
2       0.5236

I would really appreciate your help.  Thanks. 


Sohail Khan
Scientific Programmer
COLD SPRING HARBOR LABORATORY
Genome Research Center
500 Sunnyside Boulevard
Woodbury, NY 11797
(516)422-4076


<Prev in Thread] Current Thread [Next in Thread>