Re: [R] detecting the sourcing of site profile on Startup versus post-Startup

2014-04-24 Thread Benjamin Tyner
Jeff, I absolutely agree it is a bad idea to rely on side effects. I did figure out one way to skin this cat. It relies on an the following from line 909 of src/main/main.c, R_LoadProfile(R_OpenSiteFile(), baseEnv); R_LockBinding(install(.Library.site), R_BaseEnv);

Re: [R] detecting the sourcing of site profile on Startup versus post-Startup

2014-04-23 Thread Duncan Murdoch
On 22/04/2014, 8:59 PM, Benjamin Tyner wrote: Greetings, Is there any way to programmatically detect whether a piece of code is being run within the initial (Startup) sourcing of the site profile? For example, say I have a site profile, /path/to/Rprofile.site. Is there any function my_func

Re: [R] detecting the sourcing of site profile on Startup versus post-Startup

2014-04-23 Thread Benjamin Tyner
Thanks Duncan! Yes, I considered taking advantage of .First, but was concerned that the .First defined by the site profile could be masked by a possible .First defined by the user profile (I neglected to mention that --no-init-profile [sic] in the example I gave was a

Re: [R] detecting the sourcing of site profile on Startup versus post-Startup

2014-04-23 Thread Jeff Newmiller
Regardless of whether this is possible, it seems like a bad idea (side effects in a functional programming environment). If you want to do something special in startup then write a different function that does that stuff and then call the desired functions explicitly when you want them to be

[R] detecting the sourcing of site profile on Startup versus post-Startup

2014-04-22 Thread Benjamin Tyner
Greetings, Is there any way to programmatically detect whether a piece of code is being run within the initial (Startup) sourcing of the site profile? For example, say I have a site profile, /path/to/Rprofile.site. Is there any function my_func which would return different values for these two