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. Any help on this matter would be greatly appreciated! -- View this message in context: http://r.789695.n4.nabble.com/Installing-packages-from-RProfile-site-file-tp4636794.html Sent from the R help mailing list archive at Nabble.com.
On 17.07.2012 21:34, abhisarihan wrote:> 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.Yes: install.packages() starts a separate R instances to install the package which reads the Rprofile.site file and starts a separate R instances to install the package which reads the Rprofile.site file and starts a separate R instances to install the package which reads the Rprofile.site file ........ Best, Uwe Ligges 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. > > Any help on this matter would be greatly appreciated! > > -- > View this message in context: http://r.789695.n4.nabble.com/Installing-packages-from-RProfile-site-file-tp4636794.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
abhisarihan, Please don't crosspost! http://stackoverflow.com/questions/11530800/installing-packages-from-rprofile-site-file Thanks, Garrett On Tue, Jul 17, 2012 at 2:34 PM, abhisarihan <abhisarihan at gmail.com> wrote:> 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. > > Any help on this matter would be greatly appreciated! > > -- > View this message in context: http://r.789695.n4.nabble.com/Installing-packages-from-RProfile-site-file-tp4636794.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.