dear Tim,
                I have not yet ran the function. I just wanted to be prepared. 
The data is the html document and the code is the scraping code, but the point 
is, the error might be from neither data nor code, but due to the 
inconsistencies in the web page. THis can happen however perfect I make my 
code. I think save () function in the body might save me, but any other faster 
method?

Thanking you,
Yours sincerely,
AKSHAY M KULKARNI
________________________________
From: Ebert,Timothy Aaron <teb...@ufl.edu>
Sent: Monday, February 7, 2022 12:33 AM
To: akshay kulkarni <akshay...@hotmail.com>; R help Mailing list 
<r-help@r-project.org>
Subject: RE: handling breaks in a for loop

Is the bug in the data or in the code?
Can you identify the cause? Can you get a subset of the data to find the bug 
using fewer resources?
If you can identify the root cause, then you can set an error trap.
If the error is a memory problem, they you either need to save, reallocate 
memory, or get more memory.

Tim

-----Original Message-----
From: R-help <r-help-boun...@r-project.org> On Behalf Of akshay kulkarni
Sent: Sunday, February 6, 2022 1:56 PM
To: R help Mailing list <r-help@r-project.org>
Subject: [R] handling breaks in a for loop

[External Email]

dear members,
                         I have a very large for loop (basically a web scraping 
loop) with 500 iterations(over different stocks). I am concerned about the loop 
breaking midway.

My question is: is there any method to store the succesful iterations and 
continue with the iteration (ofcourse, after fixing the bug) where the 
exception occured? I can insert a save () function in the body of the loop and 
save the succesful iterations but this would slow down the execution speed. Any 
other method? I want to avoid trycatch as much as possible because an NA in the 
place of a succesful iteration would cost me much.

Thanking you,
Yours sincerely,
AKSHAY M KULKARNI

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=F0cPNGUlUW-Cd9RJzYladHn1oypv0cPLA-d9dEO42hExw8rxis6aw3FPV6DtBQU2&s=jmZ4HPdnRH6ive_u-90RBNQQtFrnMey9AZv8MRZGQbc&e=
PLEASE do read the posting guide 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=F0cPNGUlUW-Cd9RJzYladHn1oypv0cPLA-d9dEO42hExw8rxis6aw3FPV6DtBQU2&s=Tpxb0boNRBRe0_7_FZteYKLLal9zfDXAXImIExuV35o&e=
and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to