Thomas' Tidbits: A few tidbits from Thomas about a variety of topics like programming, gaming, sports and other things.



RStudio Access Denied on Network Folders
By: Thomas Hawkins     Published Date: 2020-05-20 18:26:00
r rstudio windows

I recently tried to set up RStudio on Windows.  At work, we have network mapped Documents drives, so it is impossible to save files locally on the computer, and instead everything is mounted/redirected from network shares.  This causes a problem in RStudio due to known bugs with UNC paths.  The errors will look something like this:

Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="//server/dirs$/username/R/win-library/4.0": Access is denied

It should be fixed in version 1.4 (1.2 is the latest at the time of writing this post).  The fact that it will be fixed in the future doesn't help me much, so I did some research and found out that if you change your library path on startup to a drive letter mapping instead of a server mapping, things work better.  You can load files from the network drives, and also install packages into your Documents directory.

If you type .libPaths("P:/R/win-library/3.3") and execute [adjusted for your drive mappings and folder locations], you will be able to install packages successfully.  Take note that the slashes are reversed.  You can make this run at the top of each of your scripts, or add it to your .Rprofile file.  The .Rprofile file resides in your Documents directory, and is a hidden file.  So you will need to turn on being able to view hidden files in order to see it.  If it doesn't exist, you can create it (See this link for creating hidden . (dot) files: https://stackoverflow.com/a/38425947 )

Once I made these changes, I was able to install packages and load files.

I did continue to have problems saving files, and had to use a slightly different procedure for saving files.  By default, it will load your home directory, which (in my case) is mapped to a network drive, but using the \\servername\folder syntax.  This causes problems, so I need to drop down to the network drive (P: in my case) and browse to the same folder through that path.  Then it allows the saving of the file.  If your home folder isn't mapped as a drive letter, you can do that yourself by using a command like this: net use x: \\localhost\c$\Folder\Example

Hope this helps someone.

Sources:


Comment on this post:
You can choose to post your email with your message.
Your name as it will appear on the comments section.
Showing comments:
#ByCommentPost DateLikes
Subscribe to our blog


© Thomas' Tidbits