You can interrupt the loop (e.g.. by pressing ESC), look at the results, and
then start it again.

e.g.

mumbo <- list()
for(jumbo in 1:1e+5000) {
      mumbo[[jumbo]] <- do.many.time.consuming.things.with(jumbo)
     }

# wait for a few days
# then press <ESC>

save(mumbo, file="head of mumbo")


# now restart it
for(jumbo in jumbo:1e+5000)  {
     mumbo[[jumbo]] <- do.many.time.consuming.things.with(jumbo)
    }


KK



On Mon, Apr 27, 2009 at 5:18 PM, Friedericksen <golum23@gmx.de> wrote:

> Hey,
> thank you guys for your responses.The problem is, R is already running on
> the loop. So I don't see a way to use save() oder save.image() (or any other
> function?!)
>
> Greetings
>
>
> Duncan Murdoch wrote:
>
>> On 4/27/2009 8:52 AM, Friedericksen wrote:
>>
>>> Hey guys,
>>>
>>> I have a problem: I created a silly for loop without saving the results
>>> on each step. After a while I realised that it will take days to finish the
>>> loop until I get the results.
>>>
>>> Is there a way to get the data R saves in working memory or in a
>>> temporary file while runing the loop? So that stoping the loop will not
>>> result in complete data loss?
>>>
>>> Thank you very much!
>>>
>>
>> You can use an explicit save() to write out a list of variables (or
>> save.image() to write out all of them) but then you need to work out how to
>> restart from one of these images.
>>
>> Duncan Murdoch
>>
>> ______________________________________________
>> 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.
>>
>>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]


