A user reported running a 14-hour job but an error on the very last line terminated the job and nothing was saved/returned. Here’s a few tricks to ameliorate such situations:
job::job() returns everything that’s left in the job session upon successful completion. So we just need to make the script run to the end and that’s where
try() comes in handy. Say we want to do model comparisons between two models. The following code returns everything before the erroring line:
Note that your job will be listed as “Success” in the RStudio jobs pane because it encountered no hard errors.
You can also save intermediate results to a file which can be loaded from the main session. Modifying the example above:
You can read more about exporting to files in the article on controlling exports using