I asked this question earlier, but am still unable to get it working. I am trying to install custom packages upon starting R. A lot of the code that is written by us right now is available for editing to the users. To try and protect the code, I am packaging the production level code and having the users install it on their machine during start up.
However, when I try to install packages in RProfile.site file, the program goes into a loop and R is constantly launched over and over. I noticed that a lock file for the package is created along with the package in the library folder within R.
Here is the code I have 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 starting R (without changing the site file), it installs the package perfectly fine and moves on. However, when I try to do it through the RProfile file, that's when it creates the problems.
Last time I tried resolving this issue (https://stackoverflow.com/questions/10610067/installing-packages-upon-starting-r-session), I thought Justin's suggestion of using the if statement check for packages would fix the problem. But this only seems to solve the problem for packages I install from CRAN and not custom packages.
Any help on this matter would be greatly appreciated!