Permutation of a data.frame
1
0
Entering edit mode
@paul-christophschroder-1940
Last seen 9.6 years ago
-----BEGIN PGP SIGNED MESSAGE----- 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 - -- Paul C. Schr?der PhD-Student 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGTDXmtqXwIxL/TZIRArX3AKCb3nsEie2JbJoN1SF3i3cDno1prQCfWGMN +rxycOfAHRcOR/xEm/2ErrA= =amig -----END PGP SIGNATURE-----
Proteomics Proteomics • 868 views
ADD COMMENT
0
Entering edit mode
alex lam RI ▴ 310
@alex-lam-ri-1491
Last seen 9.6 years ago
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, ] Cheers, Alex ------------------------------------ Alex Lam PhD student Department of Genetics and Genomics Roslin Institute (Edinburgh) Roslin 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@stat.math.ethz.ch [mailto:bioconductor- bounces@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 -----BEGIN PGP SIGNED MESSAGE----- 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 - -- Paul C. Schr?der PhD-Student 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGTDXmtqXwIxL/TZIRArX3AKCb3nsEie2JbJoN1SF3i3cDno1prQCfWGMN +rxycOfAHRcOR/xEm/2ErrA= =amig -----END PGP SIGNATURE----- _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
Hi, alex lam (RI) wrote: > 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) Note that you can just use Index <- sample(nrow(DataFrame)) to generate a random permutation of the row indices. > NewDataFrame<-DataFrame[Index, ] > > Cheers, H. > Cheers, > Alex > > ------------------------------------ > Alex Lam > PhD student > Department of Genetics and Genomics > Roslin Institute (Edinburgh) > Roslin > 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 > > 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 > _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY

Login before adding your answer.

Traffic: 730 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6