Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RStudio - how to recover data after crash?

Tags:

r

rstudio

Was calculating a massive amount of data that took two weeks to run. When I was trying to export the data to use in MS SQL, my RStudio crashed and I had to reopen it. Now when I try to look for the data it seems to be missing!!! YIKES!

Is that data sitting in a file somewhere or does all data you were working with in that session disappear?

Sorry for my ignorance of R. I'm pretty new to it.

Thanks in advance for any help.

like image 358
eqsf Avatar asked Jan 02 '13 17:01

eqsf


1 Answers

I'm going to stick my neck out and say that you can't.

Since R performs all calculations "in memory" I don't think you can recover anything. R Studio has some nice features that lets you recover scripts that are being edited, but it's not R and it doesn't your data in its memory. At the end of the day R Studio is just an IDE / interface to the R application, which happens to be even much more user-friendly than the default R Gui (which is also just an interface to R).

In my opinion, R is quite stable, but some of the packages that are very useful are also less stable. In my experience, RODBC is one of those. I suspect that it's complicated to make something that's reliable across many operating systems and many databases.

I would highly recommend storing any data as an RDS or RData file using saveRDS or save, and then loading that data into R and then into SQL in a separate procedure. Saving the R data using the built-in functions should be very reliable.

Generally speaking, keeping the the R to ODBC work separate will make it a lot easier to debug anyway.

Sorry about your luck with the data recovery, and I hope that it's easier to re-run than it was to run originally (i.e. I hope it wasn't a week of non-stop calculating).

like image 160
geneorama Avatar answered Sep 21 '22 15:09

geneorama