[BioC] Permutation of a data.frame
Herve Pages
hpages at fhcrc.org
Mon May 21 22:40:25 CEST 2007
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
More information about the Bioconductor
mailing list