[R] How to repeat 2 functions in succession for 400 times? (microarray data)
arun
smartpink111 at yahoo.com
Sat May 11 18:21:32 CEST 2013
Hi,
May be this helps:
set.seed(24)
mydata4<- as.data.frame(matrix(sample(1:100,10*38,replace=TRUE),ncol=38))
dim(mydata4)
#[1] 10 38
library(matrixStats)
res<-do.call(cbind,lapply(1:400, function(i) {permutation<-sample(mydata4); (rowMeans(permutation[,1:27])-rowMeans(permutation[,28:38]))/(rowSds(permutation[,1:27])+rowSds(permutation[,28:38]))} ))
dim(res)
#[1] 10 400
A.K.
>I want to do permutation test and then get a PGC score 400 times on mydata4 (microarray data)
>
>I use 2 functions as below:
>1. permutation<-sample(mydata4)
>2. PGC <- (rowMeans(permutation[ ,1:27]) - rowMeans(permutation[
,28:38]))/ (rowSds(permutation [,1:27]) + rowSds(permutation [,28:38]))
>
>What should I do to repeat these 2 functions in succession for
400 times and combine (cbind?) the 400 PGC score for the 7129 genes in
one file?
>
>Can any one help, thanks!
More information about the R-help
mailing list