How do I recover an R script? - r

I was running an R script code in Rstudio and suddenly my computer power had been lost. Now, I open the script and I can't find anything in my script except red dots (see the below figure).
I know that a similar question has been asked here. However, the answers don't work for me. How can I recover my running code?

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.

Related

R Scripts Open Blank

When I save my R scripts and try to reopen them the script is suddenly blank. Nor an update of R and RStudio or reopening it with a different encoding helped me to solve this issue. Does any one know why this error occurs. I didn't even closed RStudio inbetween when this started to happen for the first time.
I've been working already quite a while with R but nether experienced something like this.
Thank you all!

Alternative place to run my R code with more than 1GB RAM over RStudio Cloud

For some reason, my RStudio constantly crashes on start up in my windows laptop and I have an important assignment to be written in R soon. Are there any alternatives to RStudio that I can use to do this? My task takes over 1gb RAM which is just over the RStudio cloud limit hence I am unable to use that too.
I've gotten all the codes written down, just need to put them onto the Rstudio. If anyone wouldn't mind downloading the file, put my code down and send me a screenshot of the output, please let me know!
Thank you
Visual Studio Code
I second the comment that it probably is not Rstudio that causes the problem. But to answer your question:
Visual studio code has an extension for R, that would give you a quite similar experience.
At these links you can read more about the R extension and visual studio code
Edited to link to the most popular R-package.

How to attach to an already running R script

I have an R script that has been running for a couple of days. I need to change something there but don't want to lose the calculations that have already been done. Is there a way to attach to it and pause and debug? Like with gdb you can attach to an already running process.
I'm sorry to say that there is not. Not given that the script is already running.
Some extra info that won't make you feel better:
You shouldn't write scripts that have to run for days (at least in R), at least not without having them write out RDS files to save your progress.
You could've set up debugging in RStudio before you ran the script.
If you were running Rcpp code you could've used gdb with it (more info from Hadley Wickam's site here).
You can learn more about debugging R code here.

ReadAffy() Taking Too Long

I am using R 3.3.0 on Rstudio on Ubuntu 14.04 and have installed package Affy successfully.
However, when I set the directory where CEL files are, (using setwd()) and give the command cel1 <- ReadAffy(), there is no output. I don't even go the the next line with >. It simply does not show any output.
Also, Ctrl+C and Esc are also not stopping the process. Usually Esc works for stopping the process on my system. Here is the screenshot:
Also, when I try to quit the session, it takes too long to respond. What is causing this problem and how do I solve it?
EDIT:
I only have 3 CEL files in the folder.
EDIT #2:
I also applied it for single file, but takes again too much time. System monitor screenshot:
It is taking a lot of CPU and a lot of memory(in GB). What is causing the problem? I am using a simple command ReadAffy(filenames = "N54.CEL"). Why is that causing the problem? Any suggestion at all will be helpful. Kind of desperate here.
Turns out there was some problem with the file itself. I got the file from a different source, and it worked fine.

Running two instances of Rstudio simultaneously on Linux

I've got a lengthy process running in Rstudio and I would like to open a separate session of Rstudio while the first one is running. I know I can run R from the command line to get as many sessions as I want, but I wanted to know if it is possible for me to do this in Rstudio on a Linux computer. Thanks.
#infominer suggested a good solution, which is to simply type rstudio in the command line. That's what I ended up doing
Another convenient way to deal with this is to start a seperate R-instance in the terminal by typing simply
R
and from there just run the script that has a lengthy process with
source("path-to-your-script/your-script.R")
you can than continue to edit and work with your two scripts in the already opened R-Studio editor window.

Resources