## R Recipe: RStudio and UNC Paths

RStudio does not like Uniform Naming Convention (UNC) paths. This can be a problem if, for example, you install it under Citrix. The solution is to create a suitable environment file.

## Environment File

Create an .Renviron file with the following contents:

Your choice of folders might be slightly different (especially if you are using a different version of R!), but it should be essentially the same as that above.

## Default Working Folder

Of course, it’s important that RStudio can find your .Renviron file. By default it looks in your home folder. To check on your home folder location, open a new R session and then do the following:

The result of both commands should be the same, probably a Documents folder on the C: drive. This is where you need to stash your .Renviron file.

## Profile File

You can also create a .Rprofile file in the same folder. The contents of this file will be executed at startup, but after any environment changes specified in .Renviron.

To change your initial working folder to H:, your .Rprofile would look like this: