RStudio freezes while initializing Packages pane from UNC path

Hey there,

first: I'm someone who writes scripts and never got into too much detail about network things, also I'm not a native English speaker, so please forgive me if I'm not using the correct technical terms.

I never had problems with R or RStudio that didn't resolve after a few hours of hard thinking of extensive use of google, but at the moment I'm kind of stuck and unable to work - this is why I'm calling for help.

A few weeks ago I started a new job as a software developer for the government and as for now I am overwhelmed with regulations and limitations (long story short: I'm not allowed to do anything on my computer without a proper clearance first). I managed to get R and Rstudio installed (R version 3.6.1 and RStudio 1.1.453, running on Windows 10) but I'm unable to actually start coding since RStudio freezes shortly after opening.

I already realized that I'm unable to install packages, because the default in .libPaths()is set to an UNC path and R told me that it is unable to use this kind of path. That's fine because these paths seem to be kind of slow anyway, but unfortunately I have no administrator permission on my computer - so changing the default library path is not an option.

Also, the message "Do you want to use a personal library instead?" appears in R when it realizes there is no hope for the current default - but unfortunately, this second "personal path" (which is "C:/Program Files/R/etc.") is not writable for me or R as well.

But no problem, I circumvented that with using: .libPaths("C:/Users/User/writable_library_path/"as first line in all my scripts, but just encountered the next problem: I'm unable to run my scripts and therefor unable to run the first line, because R seems to need all the resources to initialize all the panes when it starts.
First, it takes several minutes until the buffering symbol in the pane "Environment" disappears and after that it takes like forever until the same happens in the pane for "Packages". As long as this is going I can't do a thing - the console does not work, opening and saving files does not work and of course setting the correct library path does not work. Sometimes I have to wait like one hour and then I can code but most often R simply freezes and I can only shut it down via the Windows Task manager.

Now my question: Is there a way to prevent this Packages pane from looking at the wrong place before I start RStudio and have to wait until the program realizes it ? I looked in Global Options and found the setting "Enable package pane" but that does not seem to prevent anything other then the looks, RStudio still freezes.

Sorry for the long post. I hope someone might have a good idea for me, otherwise I will be forced to code in SAS which the government wants me to use anyway - but my goal was to prove to them that R is better for the job... that is, when R is running properly =/

Thanks and greetings,
WZ

Yes, you can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file

# In a .Renviron file you can set it by adding this line
R_LIBS_SITE="C:\\Users\\User\\writable_library_path"

R (therefore RStudio) is going to set this as the library path on startup.

For a more detailed explanation, you can read this blog post

Thank you so much! You saved my day.

.Renviron was exactly what I was looking for. I had to use Windows PowerShell to be able to create such a file in my user directory (for luck that is not forbidden yet) and then also set R_LIBS_USER to my custom path, but now everything works like usual and I am really glad.

Thanks again and have a nice week.
WZ

This topic was automatically closed 7 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.