0

I accidentally exported a data frame in R and lost over 5,000 obs. because of that. I could reproduce the data set, but that would take me abot 24 hours of screen time.

Is there any way I can restore the xlsx-file to the last version before I hit

export(name.df, "name.xlsx")

?

The solutions suggested online don't work, i.e. opening the file in Excel and checking for last unsaved versions to restore.

To give more details, the data set was just fine, then I accidentally deleted half of it by using merge() and saved it/wrote it over under the same file name using the export() function from the package rio.

Joschi Nin
  • 37
  • 5
  • 5
    I'll quietly mention this is a learning opportunity ... have you implemented a backup strategy? If not, what better motivation than recognizing the 24h you'll lose this time. *Regardless*, there is nothing that R can do here, it's all in the underling OS and/or the file-system on which you saved the file. – r2evans Aug 30 '23 at 17:15
  • OP said `export` was from the `rio` package – Ben Bolker Aug 30 '23 at 18:18
  • Any chance your R session is still up so you can backup an image of your R workspace, secure the command history and hopefully pick it up from some intermediary object still hanging around in your workspace? https://stackoverflow.com/questions/46572193/get-complete-console-history-in-r – I_O Aug 30 '23 at 18:20

0 Answers0