Rolf, In general, I agree with you, but I am coding for a special case.
1. I am the only user and probably will be for the foreseeable future. 2. I like to have different tiers of visibility. At the public/highest level, I only want to see the functionality that I use often - my memory can only hold so much information. That means "hiding" non-everyday-essentials with a "." and not exporting it. If, in the future, there happens to be more than one user, I intend to open-source the code anyways - which means the developer/user can still tinker with the variable anyway he/she chooses. It would become less accessible if the source were not accessible (which is not my intention). I just prefer not to leave this code at the surface, cluttering the more visible/often-used code, and it looks like Martin has posted some useful snippets on how to access non-exported code. Thx! - Ken Rolf Turner-3 wrote: > > > On 7/04/2009, at 3:34 PM, Ken-JP wrote: > > <snip> > >> Using NAMESPACE, I was able to hide my globals behind a >> "." (eg .myGlobal >> <<- 72) and use exportPattern("^[^\\.]*") to prevent users from >> seeing my >> globals, yet I was able to access their values inside my package. > > <snip> > > WHY do you want to ``prevent users from seeing [your] globals''? > > The whole point of R (well, maybe not the whole point, but a major > point) is to be adaptable. If something doesn't work the way a user > wants, then the user can change things. When the inner workings > are hidden so deeply that the user can't see what to change, this > becomes effectively impossible, and the user might as well go and > use SAS. > > I exaggerate but slightly. > > Nevertheless, this syndrome of hiding things and making them > effectively > inaccessible --- which seems to have become an obsession with some > of the > R community, particularly many of the senior members --- bugs the > living > Drambuie out of me. > > cheers, > > Rolf Turner > > ###################################################################### > Attention:\ This e-mail message is privileged and confid...{{dropped:9}} > > ______________________________________________ > R-help@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. > > -- View this message in context: http://www.nabble.com/R-package%3A-Where-to-put-code-to-Run-Once-Only--tp22908592p22922387.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.