Change working directory for session crashes the R session in RStudio


I'm completely new to all things R and I'm running RStudio version 1.3.1073 on Windows 10.

I'm using a network path (on my personal NAS) to store my files. The default working directory is:
which works fine. In my working session I want to change it to \cylonraider\Misc\Repo\GitHub\learnR\ExerciseWrkDir.
Changing it to that location (using any method) throws up the following error:

R Session Aborted
R encountered a fatal error
The session was terminated.
Start New Session

Also, browsing to that folder in the Files pane fails with the same error.

Changing the working directory to C:\Temp works, but mapping my target folder to a drive and using it (like M:\RDefWrkDir) doesn't work.

Browsing to one level higher than my desired folder (\cylonraider\Misc\Repo\GitHub\learnR) and then using the menu to set the working directory to "Files Pane Location" works. But directly setting it to learnR also fails. Setting it to learnR using the above method and then browsing to it using the Files pane fails.

So there are 2 failures here - setting the working directory and browsing to it in the Files pane.

Its not the network path because the default working directory is on the same network resource and works fine. Assigning a drive letter doesn't fix it either.
Its not the path length - I've had shorter paths fail.
Its not something weird with the directory name - I've tried different directories under learnR with no luck.

Has anyone overcome this issue?
Please help.



Chiming in to say I've hit the exact same thing - we're setting up a remote desktop image for the coming Fall semester, with RStudio 1.3.1073, Windows 10, running R 3.6.3. Any attempt to set the default or current file location to a remote share crashes R. We're trying to set things to H:, which is the students' personal storage drive (and thus a space that won't be wiped when the image is shut off).

Any thoughts, workarounds, or fixes would be very much appreciated.

1 Like

Update - I got it to work ..kind of. Previously, I was trying to set it to a directory that had a few .R files in it. Just on a whim, I deleted those files and it worked! I can set the working directory to the same directory above (network path and all) when there are no files in it. Browsing to it in the files pane also worked.

Now, after a restart of RStudio I've ended up with the same problem again. The working directory has been set to the default and I have a few files in the folder that I want to setwd.

But, since I have one of the source files from that folder already open, choosing Session - Set Working Directory - To Source File Location works a treat. Of course, browsing to that folder in the files panes still causes it to crash.

@wburr - may be try with an empty folder. Or open a file from the folder first and then setwd()

Hope the defect/bugs guys will take notice of my analysis so far.


1 Like

That is exceptionally odd! I also managed to get it to work by doing the following (as you suggested):

  1. Save a .Rmd file I had open to H:/
  2. setwd()
  3. Go to Tools -> Global Options, set to H:/
  4. RStudio prompts for a restart, then works on the reboot!

I'll test the VM further tomorrow and see if a fresh launch of the VM with that setting previously set as admin persists, and doesn't crash.

Still suspect this is some kind of actual bug, though, given the hard crash that was happening prior, so when one of the support folks sees this, please don't consider this to be "fixed" or "complete" - add a ticket so someone can track it down. Very odd behaviour.

Hi all,
I've had the same problem described by ulricp and wburr. The work around suggested by ulricp works, but I think wburr is right -- it's a genuine bug (hard to believe, isn't it?).
I'm running R version 4.0.2 and RStudio version 1.3.1073. I installed (upgraded to) these versions on the weekend. The problem was apparent immediately. I had not seen this error before the upgrade to these versions.

I have been having the same problem. The error has started as soon as I update the RStudio to the latest version. See my post. R session crashes when access files/environment/history panel .
Unable to use R/RStudio.

1 Like

Also having the same problem after upgrading to RStudio 1.3.1073 and R 4.0.2
Sometimes checking the check box for the file or folder you want to open stops the session crashing.
Previous posts suggested it might have something to with Dell computers and their recovery software, which I can't find on my computer to uninstall.

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.