Where does RStudio store the temporary R script files before saved?
As indicated by @KevinUshey from RStudio:
RStudio stores autosave data as part of the JSON 'blobs' within the sdb folder. You should see the document serialized as a long 'string', with newlines embedded.
Use packages such as jsonlite
to parse this and best of luck.