Re: [R] foreach returns null first object in the list

2013-09-17 Thread pakoun
OOhhh I am sorry I didnt notice the return before the function. Everything works. Thank you :) Best regards. -- View this message in context: http://r.789695.n4.nabble.com/foreach-returns-null-first-object-in-the-list-tp4676303p4676344.html Sent from the R help mailing list archive at Nabble.c

Re: [R] foreach returns null first object in the list

2013-09-17 Thread pakoun
This is the output with the debugging message. I don't really understand what is the problem. > post.ls <- foreach(i =1:2, .verbose=T) %dopar% { + + fun <- func.list[[i]] + if(i==1){fun(Xa,Sa)} + if(i==2){fun(Ta,Sa)} + + } numValues: 2, numResu

Re: [R] foreach returns null first object in the list

2013-09-17 Thread Simon Zehnder
Use an extra call to 'return()' as posted below. On Sep 17, 2013, at 5:55 PM, pakoun wrote: > This is the output with the debugging message. I don't really understand what > is the problem. > >> post.ls <- foreach(i =1:2, .verbose=T) %dopar% { > + > + fun <- func.list[[i]] > +

Re: [R] foreach returns null first object in the list

2013-09-17 Thread Simon Zehnder
Use an extra call to return: post.ls <- foreach(i =1:2, .verbose = TRUE) %dopar% { fun <- func.list[[i]] if (i == 1) return(fun(Xa, Sa)) if (i == 2) return(fun(Ta, Sa)) } Best Simon On Sep 17, 2013, at 11:55 AM, pakoun wrote: > Dear all, > >

[R] foreach returns null first object in the list

2013-09-17 Thread pakoun
Dear all, I am sending you a copy of a demo that i am trying to make that work and embedded in a more complicated structure. The problem is that i want to get a list of 2 objects (matrices in specific, and thats why i am not specifing a .combine argument if i am not wrong..), but the first element