On Sat, Sep 4, 2010 at 10:17 AM, rajeshj at cse.iitm.ac.in
<rajeshj at cse.iitm.ac.in> wrote:>
> Hi,
>
> I have a .Call in my R function in a loop that repeats a certain number of
times. Each time, the .Call returns a list. So, when I say something like,
>
> y<-func()
>
> would y be a list of lists?(as many as the number of loops?)
No, it'll be the last thing evaluated or the result of a return()
call. Why haven't you tried this?
Try a simple example:
func = function(){
for(i in 1:10){
z=list(a=1,b=2)
}
}
and see what comes back. My suspicion is its not going to be a list of lists.
If you want a list of lists then you'll have to put the list together
yourself from the returns of the .Call, something like (not tested,
but looks okay):
func = function(){
ret=list()
for(i in 1:10){
ret[[i]]=list(i,i*2,i*3)
}
return(ret)
}
Barry