Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get unsaved script tabs

Tags:

r

rstudio

I would like to know, if it is possible to get unsaved script tabs in R studio. I accidentally open and switch to new project, then my unsaved scripts disappeared. Can anyone help to get my unsaved script tabs.

like image 691
Agaz Wani Avatar asked Feb 05 '16 11:02

Agaz Wani


People also ask

Can you recover unsaved R script?

If you had a file open in RStudio and never manually closed it, there is a good chance RStudio has a backup. This is an R package which extracts files from those backups. It can help you restore files you've accidentally deleted or unsaved changes lost in a crash.

Where does RStudio save unsaved files?

If you are a Windows user, take a look at this folder that contains the folder that starts with “s-“. RStudio should be open. There are usually files that end with “-contents”. Open some of them in a text editor and restore unsaved source code.

How do I restore RStudio files?

Press the F2 button. If you have another computer connected to R‑Studio over network, the Recover dialog box will be slightly different. See Data recovery over network for details.

How do I open a file in R?

Then, navigate to the folder in which you saved your R script file and open it again by double-clicking on the file. You might need to right click on the file and use Open With to direct your computer to open the R file with RStudio.


1 Answers

If you are on Windows, Go to the folder:

C:\Users\[your user]\AppData\Local\RStudio-Desktop\sources 

update: since RStudio 1.4.* these sources were moved to:

C:\Users\[your user]\AppData\Local\RStudio\sources 

the rest of the explanation remains the same.

and if you are on UBUNTU:

home/[your user]/.rstudio-desktop/sources 

where there are all of your unsaved tabs in folders, especially those that begin with s like s-******.

There are two kinds of file (eg. D395C3B4 and D395C3B4-contents)
D395C3B4 file contains JSON information about your unsaved tab (eg. "tempName" : "Untitled76") and your correspanding codes are in D395C3B4-contents file.
Open D395C3B4-contents with notepad.

like image 119
Iman Avatar answered Oct 04 '22 06:10

Iman