I have a strange problem on a computer that worked fine a few weeks ago.
The problem is that R cannot access the libraries under “C:\program files....”. My user is system administrator (Win 10) and all the software are installed by Administrator and I also start R as administrator.
In normalizePath(path.expand(path), winslash, mustWork) :
path="c:\Program\R\R-3.6.1\library": Access denied
I had to change “libPaths” to point to a different location and install all packages again. In my script I added the following at the beginning
Now I can run my script from R and RStudio. But I want to start my script with “rscript” using a BAT file. The same script that works in R and RStudio does not work when it is launched by rscript .
The libPaths still points to "c:\Program\R\R-3.6.1\library" despite having the command to change it in the first row of the code.
So, there are actually 2 problems:
- R cannot access libraries under “C:\program files....”.
- Starting the script (pointing to new “libPaths”) with “rscript” does not work while the same script works in R and RStudio
I appreciate all the help.