I was writing code on the console pane. Somehow I started doing this from day 1. So as I progressed down (scrolling down) with writing code in the console pane I started to experience weird things happening. The code that I wrote like half an hour ago started disappearing I don't see any anymore.
Can someone tell me what wrong I did here?
Moreover, I don't know how to bring the code back. Does R has any options like checking history? and saving option for all code we write in R.
Additionally, please share your pros and cons (I mean your experience with RStudio)of using the Rstudio cloud and installed Rstudio.
The console pane is not meant to store code for long, it'll only remember a number of lines. In RStudio, you can look for the "History" pane, that should store a longer list of recent commands (but not the output). It also gets saved in the file .Rhistory by default. Even this history will have a limit on how many lines it saves.
In any case, relying on the history is a bad idea, not only is it easy to lose, it's also context-dependent (running the same command might give a different result if you changed the data in the meantime). You should write all your code in the editor pane, you can run it with ctrl+Enter (or cmd+enter on Mac), and at the end you have a script file that you can save on your computer, and you can always restart it from the beginning to have a reproducible analysis.
Depends, the cloud has limits on memory available depending on how much you pay, the desktop version has limits depending on your laptop's memory. I would also expect things to be a bit faster and smoother on the desktop version, but again depends on your laptop.