Dear folks,

I would like to compare two unequal matrices. At the moment I realize 
this with two for loop and an if function but that's definitely too slow 
:(...

Here is my code:

for (i in 1:length(all_expressed_genes[,1])) {
   for (j in 1:length(kegg_gene_pVal[,1])) {
     if (all_expressed_genes[j,1] == kegg_gene_pVal[i,1]) {
       kegg_gene_pVal[j,4] =  all_expressed_genes[i,6]
     }
   }
}

Are there any faster solutions for that easy code? And why is R so 
dramatically slow when using for, while or other loop functions?

Thanks in advance,
Paul




-----
eMail ist virenfrei.
Von AVG überprüft - www.avg.de
Version: 10.0.1392 / Virendatenbank: 1520/3863 - Ausgabedatum: 28.08.2011 
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to