s-news
[Top] [All Lists]

Continuing a loop after function error

To: s-news@lists.biostat.wustl.edu
Subject: Continuing a loop after function error
From: Steven Wofsy <wofsy@fas.harvard.edu>
Date: Fri, 21 May 2004 19:05:54 -0400 (EDT)
In-reply-to: <E7D5AB4811D20B489622AABA9C53859101F10DB0@teal-exch.amgen.com>
I have a time series divided into segments, and I am looping over those 
segments performing nls() on data in each, using a function that 
conditions the data and calls nls().  Occasionally nls() fails, and 
I would like to perform a simple expression, return nominal values from 
the wrapper function, and continue the loop.  This 
has proven very hard to figure out--I tried combinations of on.exit() and 
on.error(), in the loop and in the wrapper function, and only succeeded in 
either terminating the loop (no results saved) or terminating Splus with 
an addressing error.

Any help would be greatly appreciated.  I am using Splus6.1 on linux.

--scw

-------------------------------------------------------------------------
Steven C. Wofsy
Abbott Lawrence Rotch Professor of Atmospheric and Environmental Chemistry
Harvard University
Division of Engineering and Applied Science/Department of Earth and
  Planetary Science
29 Oxford St., Cambridge, MA 02138
Tel. 617-495-4566; FAX 617-495-4551; http://www-as.harvard.edu



<Prev in Thread] Current Thread [Next in Thread>