Re: [R-pkg-devel] environment scoping

2016-10-27 Thread Glenn Schultz
All, Thank you, I have built the package such that it passes an object TermStrutrure to those functions which require it as an input. The package is here https://github.com/glennmschultz/BondLab The question is largely motivated by the source Mortgag

Re: [R-pkg-devel] environment scoping

2016-10-27 Thread William Dunlap
If I were writing a package for factoring integers I might store a vector of known primes in an environment in my package and have my factoring functions append to the list when they find some more primes. This works because there is only one set of of primes (given we stick with ordinary integers

Re: [R-pkg-devel] environment scoping

2016-10-27 Thread Jenny Bryan
Hi Glenn, It sounds like you should create an environment for your package. If you store these objects in the global environment, they are exposed to the user and, more importantly, user could modify or delete them. If you use an environment specific to your package, you can be sure you are the

Re: [R-pkg-devel] environment scoping

2016-10-27 Thread Duncan Murdoch
On 27/10/2016 10:05 AM, Glenn Schultz wrote: All, I would like to have some inputs available to many functions. For example, I have coefficient for a term structure fit which I would like to make a available to total return functions. Thereby eliminating the need to fit the same term struct

[R-pkg-devel] environment scoping

2016-10-27 Thread Glenn Schultz
All, I would like to have some inputs available to many functions.  For example, I have coefficient for a term structure fit which I would like to make a available to total return functions.  Thereby eliminating the need to fit the same term structure over and over again.  However, I still rea