R Scripts Open Blank - r

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!

Related

Jupyter Lab, R kernel - Wanted: to prevent Jupyter from opening the R help server

Unfortunately, I made a change to the Jupyter Lab settings recently. Jupyter had never been able to access the remote R help server. Usually this was never an issue because most help files are displayed in Jupyter. The way help is called on a function or method is typing: ?question. The "question" being the name of an R function or method. Ex. ?plot
Infrequently one of the R packages will not list its help in Jupyter and instead try to open the remote R help server. This has never worked in the past. The tab for a remote server never opened. This has never really been an issue until recently. Recently I decided to "fix" this issue and spent a good deal of time looking up the solution. I made this "fix" and Jupyter began working properly to open the remote R help server. But the fix is a problem that is way too obnoxious.
Each time I type the question mark in Jupyter, Jupyter causes the browser to open a new tab for the remote R help server. It is impossible to type fast enough after typing typing the ?. Once the ? is typed, the typing is interupted while the browser opens a new R server help website. As soon as returning to the typing, another browser tab opens and interrupts the typing .
It is impossible to finish typing the name of a function after the ? without having multiple interruptions to the typing while multiple new windows are opened in the browser at the R help server website. By the time I've finished typing: ?ppp, there will the 5 interruptions and new browser tabs opened. If I typed slowly, there may be 10 - 12 interruptions and 10 new tabs opened at the R help server.
How to prevent Jupyter from trying to access the remote R help server every time the ? is typed when looking up a description of a function? How to get back to that happy place I had before I'd made whatever change that caused this nightmare to happen?
Solved my own question.
This issue had nothing to do with R. I assumed I had changed a configuration in R, but that was not the case. This was an issue I had caused when I had changed a setting in Jupyter lab.
I can say with certainty this issue was definitely caused when I changed the "Contextual Help" setting under the Commands tab in Jupyter. This setting is related to the Contextual Help selection found under the Help tab. And this setting was causing multiple R help server tabs to open in the browser after I typed: ?
Upon rediscovering this Jupyter setting today I recalling that I had been down this path before. I selected "Contextual Help". Jupyter auto restarted and the issue went away. I can gladly say that I can perform search again for the description of an R function: Ex ?plot ,and receive the description of this function within Jupyter the same as before. I no longer have the issue of the browser opening or multiple new tabs at the remote R help server after typing ?

How do I recover an R script?

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.

Why do I get error messages when trying to save or exit from Rstudio?

I deal with a problem in R Studio. When I choose to save my work, this message shows up
And if I try to close the program, this message shows up
Any ideas why this happens? Also, I would like to ask if it is better to use the latest version of R (R4.0.2)?
Thank you for your answers. The problem was that I had open an R script file which I had deleted before. When I remove this script, Rstudio works fine.

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.

How to recover RStudio session after crash?

I would like to know how to restore my previous RStudio session after RStudio and the R session crashed.
Background:
I find that my R session crashes very often, at random times for random reasons. I am fine with that I guess.
Most of the time RStudio restarts the R session and I can continue.
But sometimes it just freezes at which time I noticed power cycling the entire machine allows RStudio to recover and even reload my old session.
Stupid me, I don't think power cycling is a good idea so I manually killed the R session, but then RStudio responded but was not really working so I restarted it and it came back with an empty work-space.
I have been backing up with Session->Save Workspace As, but it seems to do nothing as recovering leaves me with the blank empty environment.
I am looking to restore the RStudio display, including the command history , which for a novice like me is precious, and my list of open scripts, some of which were unsaved at the time of the crash.
I am assuming since RStudio can recover itself, there is a file somewhere I can use to recover it.
And if there is no way to recover, how can I completely save my workspace so this cannot happen again?
Also, is there a proper way to recover from an RStudio freeze without a hard reset?
It has been a while since I asked this question. I was never able to fully recover, but I switched to Rprojects which is the recommended way to use Rstudio.
Rprojects are stored in a folder and they remember all files and data from that project in that folder.
This did not help me with my initial problem, but projects prevent it from happening again. The hard part is moving a work-space to a project if it was not in a project to start.
Hi the first step of this article helped me entirely.
https://datacornering.com/how-to-restore-closed-unsaved-script-in-rstudio/
Basically, if on windows, go to C:\Users\xx\AppData\Local\RStudio\sources\s-xx and find a file with "-contents" at the end. This is your unsaved file.

Resources