stop at error point in for-loop

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

stop at error point in for-loop

mrzung
hi all:

Following is simple example,

for(i in 1:10000000){
a<-function(i){
#some function that has an error
}
}

What I want to know is the way to find the error point in for-loop, What "i" makes the error.

is there any way to solve it instead of debugging and finding an error manually?

Thanks,

Reply | Threaded
Open this post in threaded view
|

Re: stop at error point in for-loop

Jeff Newmiller
options(error = recover)
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<[hidden email]>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

mrzung <[hidden email]> wrote:

>hi all:
>
>Following is simple example,
>
>for(i in 1:10000000){
>a<-function(i){
>#some function that has an error
>}
>}
>
>What I want to know is the way to find the error point in for-loop,
>What "i"
>makes the error.
>
>is there any way to solve it instead of debugging and finding an error
>manually?
>
>Thanks,
>
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/stop-at-error-point-in-for-loop-tp4646115.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>[hidden email] 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.

______________________________________________
[hidden email] 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.