On Mon, Jul 20, 2009 at 2:48 PM, Olivier ETERRADOSSI<olivier.eterrado...@ema.fr> wrote:
>> x <- foreach(i = 1:3) %do% sqrt(i) > > and get : >> >> Erreur dans sqrt(i) : indice hors limites ( i.e. "error in sqrt(i) : index >> out of bounds") I once got similar errors because I didn't encapsulate the part af %do% or %dopar% in curly brackets. Try x <- foreach(i = 1:3) %do% { sqrt(i) } I should say, however, that in this particular case, your original code evaluates without errors on my computer (Mac OSX 10.5.7 with R 2.9.1). By the way, remember to use %dopar% instead of %do%, if you want to take advantage of multiple cores. While being totally ecstatic after discovering foreach, I wrote the following (very simple) guide: http://lifeofknudsen.blogspot.com/2009/07/most-of-work-i-do-in-r-has-to-do-with.html Maybe you'll find it useful, maybe not. -- Michael Knudsen micknud...@gmail.com http://lifeofknudsen.blogspot.com/ ______________________________________________ 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.