Dear Lionel, Hugh and Dirk,
Many, many thanks for your input. I will definitively study the different
proposals and will check on the different implementations and ideas to
evaluate what is the most convenient. And will do a crash course on
environments and learn something new.
At first sight the
Agreed. I have used `.pkgenv` in a few packages (digest, rpushbullet, ...),
and usually added a comment that it is package-global.
And so have a few others:
https://github.com/search?l=R&q=org%3Acran+pkgenv&type=Code
Dirk
--
https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
_
Agreed. One can also initialise such an environment as a package option in
.onLoad which may be better or worse depending in part on how much
restriction you want to place on the environment
On Sat, 27 Nov 2021 at 12:41 am, Lionel Henry wrote:
> Hello,
>
> The trick is to store cached objects in
Hello,
The trick is to store cached objects in an environment. In our team
some of us have started calling this environment "the" to reflect that
the elements in that environment are global singletons.
Create the environment somewhere in your package:
```
the <- new.env(parent = emptyenv())
```
Dear all,
I am writing a package that needs to load some data from a URL and have
such data (meta data) available when using other functions in the package,
and I would like some advice on how to properly manage such situation.
My first guess would be to create a function to downloads that meta