how to start Rstudio from where it was before (including history, plots, previous command in console) quitting Rstudio

Hi Rstudio Community,
I facing one trouble in Rstudio,
Whenever i quit Rstudio (save workspace-->yes) and/or turn off my laptop and later if i start again Rstudio, i lose my history, and already made plots (all the time).
How can i avoid this situation?

Whenever i start my Rstudio, it should also load all previously loaded packages.

My question if for Rstudio in windows and ubuntu as i use both.
Thanks

Hi,
If you save your workspace, a workspace image is saved in a .RData file. Have you tried loading this file into Rstudio when continuing your work? You can use load("your_file.RData") to do that.

However, I would recommend you not to rely on your history and previous commands in the console as a mean to track your work in R. This is a very error prone method and is not very reproducible. Intstead, you should use your scripts or an R Notebook to save your work.
This is especially usefull when working on something over a long period of time, or when you have to revisit your old projects. If you save everything in a script, you can directly see all of your code, and everything that is executed in R is clearly documented there.
From my understanding, it is rather uncommon, and at least from some sources discouraged to even save your working environment, so I would recommend you to invest a little bit of time to familiarise yourself with scripts or R markdown, you will quickly see all the advantages that will bring to you.

Hi,
I did load my previous >RData but still couldnt find the old plots and scripts.

I do save my R scripts but since i am trying some new analysis for my work etc. sometime, i need to go back and check, and make modifications accordingly. This is not one day job, and so that's why i was thinking if i could see some history and plots.
Please let me know if you any other suggestion

also Now onwards, i will save everything, even my new trial scripts,

Thanks,

For your security and benefits, consider going to the next level and using version control to develop your scripts. By this I mean the use of git/github to manage your source history for a project.

1 Like

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.