Hello R users, I have gene expression data of two groups of genes (large and small). Gene expression intensities of those genes are classified into 1 to 10 levels. What I want is to make a random set of genes that have the same levels as the small group from large group using sample().
I used smallvec to hold the number of genes in each levels (1 to 10) for small group, largevec for large group. I ordered the gene expression data frame of large group (largedf) by the levels and randomly chose the genes with same level as small group. Using the code below I can get the random set of genes from lagre group with same levels for small group. But I got the same set of genes when I run the code in every other runs in Linux. This gives me a doubt in my result. smallvec<-c(8,12,9,6,13,20,16,11,8,5) ## the No. of genes in levels 1 to 10 largevec<-c(400,300,550,600,210,420,380,600,450,500) generdm<-c() ## a random set of genes for( i in 1:length(smallvec)){ generdm<-c(generdm,sample(rownames(largedf)[sum(largevec[0:(i-1)],1):sum(largevec[0:i])],smallvec[i])) ## rownames(largedf) gives gene names ordered by levels in large group } Could you please help me out? Thanks a lot!! Josh ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.