Directory error when starting Rstudio

Hi everyone, When I open RStudio 1.2.1335 with R version 3.6.1, I get an error message error: '\R' is an unrecognized escape in character string starting ""c:\R".
There already was someone with the same error in this post: Directory error at start up but I don't understand the solution and can't reach that user to clarify. Can someone help me out on this?

Extra info:
starting up Rstudio without doing anything results in this error:
and have the following setup in Rstudio:

The solution reported by that user involves modifying keyboard shortcuts in RStudio. You can check whether you have the same issue by going to Tools -> Modify Keyboard Shortcuts and selecting the Customized radio button.

If you have modified the keyboard shortcut for Run Current Line or Selection, it should show up here. You can then reset it to the RStudio default and see if that fixes the problem.

Thanks for the reply: it does not seem that I modified these shortcuts, and when resetting these settings to default (just for trying it out) sadly it does not solve the error. I usually go with the setwd() within each project/Rmarkdown file, so I don't completely understand where this error comes from.
Any ideas?

Just out of curiosity, are you restoring .RData into your workspace when launching RStudio?

No, I don't have that option checked. I just came across a unexpected error when updating packages, and it seems to be caused by the default work directory:

Could this give any information as why it does not work? I don't have any experience with this problem, so I hope this will give some more insight!

Can you check if you get the same error when opening R GUI? That'll help us understand whether the problem is with R or RStudio's configuration.

Yes, tried it and it shows the same error as in Rstudio.

So it's likely that the issue has to do with R's configuration. What is the output of getwd() in a fresh session of R?

Sure, it's from a networked PC at work so I blanked out some of the path:


It's on a networked drive, so it's no local folder on C:. I do have R/Rstudio installed on the C: drive.

Ah, I see. I've heard of some users encountering problems when using R with networked drives (see thread below).

Unfortunately, I'm not familiar with this type of R setup and cannot provide further assistance. Maybe someone else will be able to guide you.

Thanks for the help so far and I will dig into the mentioned thread!

Have you try // instead of just /?

Yes and it does not seem to work. Thanks for your suggestion though!

Thanks for the bug report -- this sounds similar to this issue.

We're hoping to have a fix for this in RStudio v1.3. As a workaround you can try the following:

For what it's worth, I believe one workaround would be to set R_USER to the same server path (as UNC), but with different casing -- e.g. with the server name capitalized. (This affects how RStudio tries to perform tilde expansion / path aliasing, which I believe is the root cause of the issue here)

Hi Kevin,

Thank you for the response and information. I will try the workaround and also look forward to RStudio v1.3! :slight_smile:


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.