Global variables not saved after executing R code - r

Recently I swapped my personal PC with admin rights to my employee's PC, where we use AD to log in and where I do not hold admin rights.
Since that event, I have trouble running my R code. I currently develop Shiny app. Each time I click "Run app", two things appear to behave differently versus my old setup.
First of all, I can run app only once - after that, the Rstudio is busy forever, suppressing me from running app again, accessing data frames created by my app and so on. So after each test of some changes, I literally have to reset entire RStudio.
Secondly, despite the fact that I have set my working directory to "C:/Users/mylogin/Documents", after restarting R, there are no global variables visible, event after saving workspace image. I used to use global variables to debug my app after closing it. Of course I can rewrite entire code to, for example, dump all the tables to different files.
My question is: is it possible, that this behavior is related to not having admin rights on my current PC? Or is it related to another issue and if so - may someone provide me some help in that matter? I have little to no knowledge about debugging Rstudio.
Setup: Win 10 64bit, R version 4.0.2 (2020-06-22) Rstudio desktop, 1.3.1093, Apricot Nasturtium.

For future generations: the problem perished, without any particular reason, quite frustrating that we will never know the answer.

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 ?

R studio not responding

My RStudio is opening multiple processes(opening R Studio in different windows) when I open just one. I am not able to open any project. It becomes unresponsive. I tried using in compatibility mode, running as admin and also uninstalled. But still,(here's the image) the same problem persists. Can someone please help me?
Before you reinstall everything, which may take a lot of time, it is worth removing application data, which is a cache R keeps of last sessions etc. It involves settings such as information from last session, etc which RStudio tries to reopen every time you open it.
For app data, look under your user folder which must be somewhere like
c:\Users\<your_user_here\AppData\Local
c:\Users\<your_user_here\AppData\Local\LocalLow
c:\Users\<your_user_here\AppData\Roaming
Delete every subfolder called R, RStudio-Desktop or RStudio under these folders. Don't worry, you won't lose your source program files and projects. It may help you recover everything without having to start over from scratch.

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.

Strange R message: Persistent UI failed to open file

I have just updated my R to version 3.1.1 on my Mac machine, and since then have started getting this strange message when running analyses.
Persistent UI failed to open file ..../org.R-project.R.savedState/window_2.data: No such file or directory (2)
Where I have written the .... there is the rest of the file directory, but I didn't think it necessary to add in.
There does not appear to be anything specific that sets off this error. I am usually running a number of R windows at once - which are running difference analyses (around 6) and the error appears across all windows at roughly the same time I think, I am not usually watching the analyses tick over.
It doesn't kill the analyses. And I haven't found it causing any problems.
I am just curious what it means, and how I should fix it?
Thanks,
Sam
This is pretty old, but I just ran in to the same problem.
You see this message because R does not have permission to change your ~/Library/Shared Application State directory.
If you want to change it, 1 just navigate to the folder, 2 right click it, and 3 uncheck the lock checkbox or change the permissions to that folder.
I don't mind the R error message because I hate OSX writing all the current application states to that folder.

RStudio server - Hangs when switching projects

I am currently running RStudio via a server installation that I only partially maintain. I am working with some fairly large data sets and models (> 9 million rows of 611 variables). When I try to switch projects, RStudio hangs when loading the project (it says "Switching projects to..." at the top) or, if it loads, takes forever.
RStudio works otherwise while attempting to switch projects, but menus and the like do not work.
I have searched thoroughly for a fix to no avail. How would I go about troubleshooting (or, ideally, fixing) the problem?
RStudio is running on a linux (Open SuSE) VM.
Thanks in advance.
EDIT: Per this thread: https://stackoverflow.com/a/15373596/3469671, I deleted .rstudio from my home directory and that seemed to free things up. Is there some setting I can change to facilitate the loading of larger projects?
Per this thread, I deleted .rstudio from my home directory and that seemed to free things up.
As a practice, I learned to stop saving my workspace while it was loaded with data and included steps within projects to save and load prepared data.

Resources