RStudio: saving data from the viewer

Due to a stupid error and a faulty USB drive, I lost a bunch of data, and now I'm trying to recover it.

Some of the data is still displayed on the Viewer tabs when I open RStudio. However, I can only save R Scripts and R Markdownfiles from the Viewer. The data frames displayed are good and full, I can sort and filter them in the viewer, however I cannot find the “save” option. Is it possible to save this displayed data in Rdata or csv or something similar?

+6
source share
2 answers

I would suggest three different approaches, but none of them will necessarily work. I sort them according to my expectations of success.

1) You can copy your entire data frame from the viewer and paste it into external spreadsheet software to obtain a CSV file. For instance. through the button "convert text to columns" in MS Excel.
2) You can copy and paste a string of characters into an object, which is passed to the text parameter read.table or dput() . Check out the Copy Data section of this famous SO question
3) Finally, you can get the google Chrome function "Check item" to check the html code of the object in the viewer. When you find the table, you can copy the paste and clean it with an html parser, for example. using the rvest package. Good luck

+5
source

Thanks to everyone, there is a way to access data in the form of Rdata files, which was kindly explained to me here.

I used the second method and found the files in %localappdata%\RStudio-Desktop\viewer-cache .

+3
source

All Articles