How to get unsaved script tabs
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.
How do I recover an R script?
There is a file in my directory C:\Users\Mohammad Nabati\AppData\Local\RStudio-Desktop
named history_database.1
that I found the history of running.
Recover unsaved SQL query scripts
Posting this in case if somebody stumbles into same problem.
Googled for Retrieve unsaved Scripts and found a solution.
Run the following select
script. It provides a list of scripts and its time of execution in the last 24 hours. This will be helpful to retrieve the scripts, if we close our query window in SQL Server management studio without saving the script. It works for all executed scripts not only a view or procedure.
Use <database>
SELECT execquery.last_execution_time AS [Date Time], execsql.text AS [Script] FROM sys.dm_exec_query_stats AS execquery
CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql
ORDER BY execquery.last_execution_time DESC
Restore unsaved MySQL Workbench scripts?
You can try to find your script in History Output. Check this answer: MySql workbench query history ( last executed query / queries ) i.e. create / alter table, select, insert update queries
Related Topics
Data Input via Shinytable in R Shiny Application
R: How to Split a Data Frame into Training, Validation, and Test Sets
How to Add Multiple Captions in Ggplot2 Outside of the Main Graph Area
Take Sum of a Variable If Combination of Values in Two Other Columns Are Unique
How to Save() with a Particular Variable Name
Add a New Column to a Dataframe Using Matching Values of Another Dataframe
Changing Million/Billion Abbreviations into Actual Numbers? Ie. 5.12M -> 5,120,000
Using R Statistics Add a Group Sum to Each Row
How to Replace Na (Missing Values) in a Data Frame with Neighbouring Values
Unexpected 'Else' in "Else" Error
Get the Row and Column Name of the Minimum Element of a Matrix
Advantages of Reactive VS. Observe VS. Observeevent