[R] Using try()

Spencer Graves spencer.graves at pdf.com
Thu Sep 30 18:49:15 CEST 2004


      Are you using ESS?  If yes, can you try to code in RGui, without 
Emacs or XEmacs? 

      If that fails, "PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html", and tell us which version 
of R, what operating system, etc. 

      hope this helps. 
      spencer graves

Nathaniel B. Derby wrote:

> Hello R people,
>
> I am need some help using the try() function.  Currently I am running 
> a loop which uses arima() for some values of p and q, which sometimes 
> crashes.  When it crashes, I want the program to just ignore it and 
> move on to the next values to loop through.  I currently have this, 
> looping through a range of values for p and q:
>
> lo = try( arima1 <- arima( y, order=c( p, 0, q ) )
> if( !inherits( lo, "try-error" ) ){
>      ... code here ...
>      }
>
> This works perfectly for my purposes, with one exception:  Everytime 
> the program invokes try(), I have to press Esc in the R console for 
> the program to continue.  How can I avoid this (so that I don't have 
> to keep pushing Esc).
>
> I tried reading the help file for tryCatch(), which showed a wide 
> range of options to try (no pun intended), but this confused me.
>
>
> Thanks,
>
> Nate
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html


-- 
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567




More information about the R-help mailing list