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.
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With