I am not sure exactly what you mean with your question.  If you have a
named list and want to access the 'name' within the 'for' along with
the value, then you can do something like this:

for (i in names(myList)){
    value <- myList[[i]]   # get the values
    plot(values, main=paste("Plot of", i))
}

A little more clarification is need on your question.

On Fri, Nov 21, 2008 at 3:30 PM, Mike Rowe <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> I have been playing around with the R/Parallel package, which can farm out 
> the computation of a for-loop among multiple worker processes.  Each worker 
> gets a chunk of the for-loop iterations; for example, if you have two workers 
> and for(x in 1:1000){...}, one worker would typically get iterations 1:500, 
> while the second does 501:1000.
>
> I would like to be able to preallocate matrices to capture the results within 
> the for loop, on the first iteration.  Is there a way to access the list 
> argument of the "for" function programmatically from within the loop?  I am 
> referring to the for arguments shown on page 51 of the R Language Definition 
> manual:
>
>   "for"(var,list,expr)
>
> I think I have a work-around, but was curious whether this was possible...
>
> Thanks,
> Mike
>
>
>        [[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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

______________________________________________
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