[BioC] Permutation of a data.frame

alex lam (RI) alex.lam at bbsrc.ac.uk
Thu May 17 14:06:54 CEST 2007

Dear Paul,

Not sure if I understand fully. I think you are saying that you want to shuffle the rows, but keep the code with its corresponding p-value together.

In that case, you can simply use the sample() function.

Index<-sample(1:nrow(DataFrame), size=nrow(DataFrame), replace=F)
NewDataFrame<-DataFrame[Index, ] 


Alex Lam
PhD student
Department of Genetics and Genomics
Roslin Institute (Edinburgh)
Midlothian EH25 9PS
Great Britain

Phone +44 131 5274471
Web   http://www.roslin.ac.uk

Roslin Institute is a company limited by guarantee, registered in Scotland (registered number SC157100) and a Scottish Charity (registered number SC023592). Our registered office is at Roslin, Midlothian, EH25 9PS. VAT registration number 847380013.

The information contained in this e-mail (including any attachments) is confidential and is intended for the use of the addressee only.   The opinions expressed within this e-mail (including any attachments) are the opinions of the sender and do not necessarily constitute those of Roslin Institute (Edinburgh) ("the Institute") unless specifically stated by a sender who is duly authorised to do so on behalf of the Institute

-----Original Message-----
From: bioconductor-bounces at stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Paul Christoph Schröder
Sent: 17 May 2007 12:01
To: bioconductor at stat.math.ethz.ch
Subject: [BioC] Permutation of a data.frame

Hash: SHA1
Hello all,

I have a data frame like this:

  Code         pvalue
GT2984      0,0665
GT9301      0.1203
GT9271      0.0123
GT1203      0.0023
.............         ..........
and so on.

I would like to permute only the rows, i.e. at start GT2984 with pvalue 0,0665 is at position 1 and after the random permutation it would be elsewhere but with his pvalue, i.e. GT2984 with pvalue 0,0665 at position 19. And this should happen with every row from the data.frame.

How could I achieve this?

Thanks in advance,


- --
Paul C. Schröder
Division of Proteomics, Genomics & Bioinformatics Center for Applied Medicine (CIMA) University of Navarra Avda. Pio XII, 55
E-31008 Pamplona, Spain

Tel: +34 948 194700, ext 5032
email: pschrode at alumni.unav.es

GnuPG Fingerprint
F1B6 4D01 D870 264D 3A16 9BA4 B6A5 F023 12FF 4D92

Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

More information about the Bioconductor mailing list