I have a question regarding the best practice when installing packages.
I have had some problems lately with packages that require compiling that gives errors when it requires compiling (specifically the package digest and tmaps). I've done some research and found the following code on stackoverflow.com
.libPaths(c(.libPaths()[2], .libPaths()[1]))
This solved the problem to install the package but I then realised that some of my packages live in the "C:/Program Files/R/R-3.6.2/library" folder where others are in the "~/Documents/R/win-library/3.6" folder. So when I run RStudio as administrator I have access to all the packages but when I run RStudio as a user I only have access to the packages installed in the "~/Documents/R/win-library/3.6" folder with all the resulting errors.
This brings me to my question: what is best practice to install R packages and RStudio settings to avoid this work around? What is best practice folder structure for R, R Libraries and RStudio for Windows users?
Any comments and guidance will be appreciated.