RStudio fails to save scripts. Also, autosave?

I have had several instances recently where File > Save All followed by File > Quit session has failed to save my scripts. At first I thought this was a Windows problem because I was having some windows problems at the time, but these are now resolved and the failure to save has continued to recur.

There are commonalities in the sessions where this problem happened. First, all of them began from an open session with File > Open Project in a New Session. The original, different, project remained open in its own RStudio window. Second, in each case I then opened the second project by selecting the .RProj file (st_exp.RProj). Third, although my scripts were not saved - or at least, not saved in the project directory under the name I gave them -- the History file was nearly current, and the data files, though apparently absent in the environment window, reappeared when I refreshed the view with the gear button in the upper right.

I am pretty sure it has nothing to do with my code with the code in the second project I opened, at least.

I've been able to partially reconstruct my work in each case using the history file, but it has entailed a lot of lost time and duplicated effort. Does anyone have a clue how i can prevent this from occurring? Do I just have to give up keeping two instances of R/RStudio open at the same time? One of the two projects - the originally open one in the description above - involves loading 11 GB and takes 10 to 15 minutes or so on my slow machine, so I prefer to close and reload it only occasionally.

OK, I found the autosave.

There are some web references to RStudio saving scripts to
C:\Users\my_user\AppData\Local\RStudio-Desktop. i
I found this directory, but if it has script backups in it, I couldn't find them.

However, I did find the backup in a different location:
~\R\project_name.Rproj.user\6217FBFE\sources\per\t
under the name:
F7B83C5-contents

The .Rproj.user directory seems like a good place to stash the backups. And the backup appears current, which saves me a lot of work. However, I must admit that I find both the sub-directory structure and the filename a little cryptic.

And nI still want to know why RStudio is not recovering my script from this backup.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.