Setting library path in start up - It won't work, PLEASE HELP.

Ok, I'll try asking this question a different way.

I found a thread showing how to change the lib path in the library base (start-up) file. I tried this fix (C/O Marcus)...
image

I managed to change the path from the roaming profile to the local R library, then realised that I could not write to this as a user (only admin). So, I made a new local folder C:/R_packages, and updated the startup code to reflect the new location, saved, and tested in user mode. It's still trying to install to C:/ Program Files/R/R_4.0.3/library. I've since returned the startup code to "R_USER", tested it - it had returned to the roaming profile - then tried the new library path again and still got this error...
image

Try this:

  • Locate the directory: C:/ Program Files/R/R_4.0.3/library
  • Right click on it
  • On the dropdown menu, click on properties
  • At the bottom of the Properties window that appears, uncheck the Attributes at the bottom that says: "Read-only (Only applies to files in folder)".
  • Restart RStudio and try to install your package again.

Thank you gueyenono.

I gave it a go, no dice unfortunately. It just reverts to 'read-only'. I set it in admin, and also changed my user security permissions, but I'm still getting the 'lib = "C:/Program Files/R/R-4.0.3/library"' is not writable error.

Not sure why. Repeat the same process and restart your computer. Let's see if it reverts back to read-only after that.

No, still no good. It actually seems to return to read only as soon as I close properties dialog box (I did re-start as you suggested, this was just an observation I'd already made).

Alright, so I had my brother who's an IT professional come and have a look at this issue for me, and here is the solution he found after a couple of hours work. It took a bit of work to find where to place it, but rather than putting the following code

# User R Profile scrips
# My custom start-up code
myPaths <- .libPaths()
myPaths <- c(myPaths[2])  # switch nexus[1] to C[2]
myPaths <- c('C:/R/win-library/4.0', myPaths ) # add new path
.libPaths(myPaths)  # reassigns the path

in to the source .rprofile code in the C:/Program Files/R/R-4.0.3/library/base/R file, he left that as it was and created a new .rprofile (text file) in the local "Documents" folder with the above code in it. Obviously this protects the integrity of the source code and also means that I'm going to have less (if any) issues when updating R/Rstudio.

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.