[S] Summary: saving partial results from unfinished for loop

Franz-Josef Mueter (mueter@ims.uaf.edu)
Mon, 3 Aug 1998 09:34:02 -0800 (AKDT)


I posted the appended question earlier and the short answer is NO. As
Prof. Ripley pointed out that would conflict with the back-out model
of S.

However, if options(error=dump.frames) is set, not all is lost. In that case
debugger() (UNIX only) can be used to inspect values of variables in use at
the point when the function was aborted.

Of course, to avoid the problem in the first place, one should use
on.exit or assign(immediate=T) inside the function, as noted by Prof. Ripley!

Thanks to Prof Brian D Ripley, David Smith, Tim Hesterberg, Matt Calder,
and Samuel E. Buttrey

On Mon, 3 Aug 1998, Franz-Josef Mueter wrote:

> Dear S+ers
>
> I have come across this several times now and thought I'd ask.
> For saving results from bootstraping or some randomization test I often
> write functions that
> 1. create an empty matrix for storing results
> 2. loop through i cases and perform a series of computations for each case
> 3. store result (either a single value or a vector) from the ith
> computation in the ith row or column of the results matrix
>
> Now sometimes I get impatient and would like to quit before the function
> is finished. Is there any way to stop execution of the function, yet
> somehow save the matrix of partial results (having neglected to built
> appropriate features into the function itself!)
>
> Thanks for any hints,
>
> Franz
>
> ***************************************************************
>
> Since all models are wrong, the scientist must be alert
> to what is importantly wrong. It is inappropriate to be
> concerned about mice when there are tigers abroad.
> - Box, 1976
>
> ***************************************************************
> Franz-Josef Mueter | Voice: (907) 474-7839
> Institute of Marine Sciences | (907) 479-8815
> School of Fisheries and Ocean Sciences | Fax: (907) 474-1943
> University of Alaska | e-mail:
> Fairbanks, Alaska, 99709-1080 | mueter@ims.alaska.edu
> ---------------------------------------------------------------
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message: unsubscribe s-news
>
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news