Dear list,
I'm wondering how to optimize functions/processes like the one shown below (which simplifies something we're trying to do with very large datasets). In many cases I've noticed that using apply, sapply etc can help speeding up processes, but in this case I don't see how I could do so.

a <- runif(10000000,0.5,1.6)
C <- 2
M <- 10000000
system.time( for (i in 1:(M-1)) {C <- C* c(a[i],a[i+1])} )


By the way, I'm using R-2.7.2 on Win XP and/or Fedora Linux.

Thank's in advance for any hints,
Wolfgang Raffelsberger

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wolfgang Raffelsberger, PhD
Laboratoire de BioInformatique et Génomique Intégratives
CNRS UMR7104, IGBMC 1 rue Laurent Fries, 67404 Illkirch Strasbourg, France

______________________________________________
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