.Rhistory not overwriting

Hi there,

Had a frustrating issue where I lost a lot of code and wanted to get it back via .Rhistory. However when I checked it seemed this hasn't been overwritten since 3 years ago! So my Rhistory is not being updated despite this option being selected in the settings.

Seems like my Rstudio cannot overwrite an older file, tried starting Rstudio with admin rights and putting in some new random lines - but these were not saved either.

Any clues appreciated

Thanks, Matt

Hi @mattybenwah
The .Rhistory file is appended to (not overwritten). Perhaps your old one is damaged or corrupted? Try renaming it (or deleting it) and see if R (either in RGui or RStudio) will create a new one. Perhaps R was writing to an .Rhistory file in a different directory (maybe check them all for any recent changes)?
There is some pertinent info here but not sure what OS you are using:
https://rdrr.io/r/utils/savehistory.html

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.