I asked this question before, but still can't get it to work. I try to install custom packages when I start R. Most of the code we wrote right now is editable for users. To try to protect the code, I pack the production level code and install it on my machine during startup.
However, when I try to install packages in the RProfile.site file, the program goes into a loop, and R constantly runs over and over again. I noticed that the lock file for the package is created along with the package in the library folder inside R.
Here is the code that I added to the site file:
if(length(grep("customPackage", installed.packages()[,1]))==0) { install.packages("customPackage", repos=NULL, type="source") }
When I try to run this code after running R (without changing the site file), it installs the package perfectly and moves on. However, when I try to do this through an RProfile, this creates problems.
The last time I tried to solve this problem ( https://stackoverflow.com/a/360560/60 ), I thought the Justin suggestion about using if statement validation for packages would fix the problem. But this only seems to solve the problem for packages that I install from CRAN, and not from custom packages.
Any help on this would be greatly appreciated!
source share