Re: [R-pkg-devel] Best way to cache a dataframe available for all functions in a package

2021-11-26 Thread X FiM
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

Re: [R-pkg-devel] rstan issue [Was: CRAN submission error when running tests in testthat]

2021-11-26 Thread Simon Urbanek
Nathan, no action is needed on your end since it's not your fault. It was good of you to have the test there because it unearthed the issue. I have re-run the test with hot-fixed rstan and it passes the check so you're good as far as I'm concerned. As you say, since it's not a strong dependen

Re: [R-pkg-devel] Best way to cache a dataframe available for all functions in a package

2021-11-26 Thread Dirk Eddelbuettel
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 _

Re: [R-pkg-devel] Best way to cache a dataframe available for all functions in a package

2021-11-26 Thread Hugh Parsonage
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

Re: [R-pkg-devel] Best way to cache a dataframe available for all functions in a package

2021-11-26 Thread Lionel Henry
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()) ```

[R-pkg-devel] Best way to cache a dataframe available for all functions in a package

2021-11-26 Thread X FiM
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

Re: [R-pkg-devel] rstan issue [Was: CRAN submission error when running tests in testthat]

2021-11-26 Thread Nathan Green via R-package-devel
Thanks everyone for your help with this.TBH the technical nature is more than a little above my head.What are you advising as the current solution to enable me to resubmit the package to CRAN?BCEA doesn't have a strong dependency on rstan so I could remove it as a simple solution?Thanks again fo