Re: [Rd] set.seed() in a package

2019-11-06 Thread Marvin Wright
Thanks for your answers. I agree with Duncan and Henrik that we should have such a policy, even if we cannot test it. > On 30. Oct 2019, at 17:59, Henrik Bengtsson > wrote: > > Forgot to say: For, > > oseed <- base::getRandomSeed() > on.exit(base::setRandomSeed(oseed)) > > one could upgra

Re: [Rd] set.seed() in a package

2019-10-30 Thread Henrik Bengtsson
Forgot to say: For, oseed <- base::getRandomSeed() on.exit(base::setRandomSeed(oseed)) one could upgrade set.seed() to take this role, e.g. oseed <- set.seed(0xBEEF) on.exit(set.seed(oseed)) Current, set.seed() always return NULL. BTW, and my memory might be bad, I think I mentioned th

Re: [Rd] set.seed() in a package

2019-10-30 Thread Henrik Bengtsson
> On 30/10/2019 9:08 a.m., peter dalgaard wrote: > > You can fairly easily work around that by saving and restoring .Random.seed. This is actually quite tedious to get correct; it requires you to under how and when .Random.seed is set, and what are valid values on .Random.seed. For instance, a c

Re: [Rd] set.seed() in a package

2019-10-30 Thread Duncan Murdoch
On 30/10/2019 9:08 a.m., peter dalgaard wrote: We commit a similar sin in the help pages, e.g. example(set.seed) ; runif(2) example(set.seed) ; runif(2) gives you the same random uniforms both times. (Of course it isn't that much of an issue, since you would rarely be running examples before a

Re: [Rd] set.seed() in a package

2019-10-30 Thread peter dalgaard
We commit a similar sin in the help pages, e.g. example(set.seed) ; runif(2) example(set.seed) ; runif(2) gives you the same random uniforms both times. (Of course it isn't that much of an issue, since you would rarely be running examples before any serious simulations.) You can fairly easily

Re: [Rd] set.seed() in a package

2019-10-30 Thread Duncan Murdoch
On 30/10/2019 3:28 a.m., Marvin Wright wrote: Hi all, I recently found several calls of set.seed() in a CRAN package. These calls are in a plot function, which could lead to unexpected behaviour. See https://github.com/sammo3182/interplot/issues/33

[Rd] set.seed() in a package

2019-10-30 Thread Marvin Wright
Hi all, I recently found several calls of set.seed() in a CRAN package. These calls are in a plot function, which could lead to unexpected behaviour. See https://github.com/sammo3182/interplot/issues/33 for a description of the problem. I c