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

Re: [Rd] head.matrix can return 1000s of columns -- limit to n or add new argument?

2019-10-30 Thread Martin Maechler
> Gabriel Becker > on Tue, 29 Oct 2019 12:43:15 -0700 writes: > Hi all, > So I've started working on this and I ran into something that I didn't > know, namely that for x a multi-dimensional (2+) array, head(x) and tail(x) > ignore dimension completely, treat x as an

[Rd] stats::reshape quadratic in number of input columns

2019-10-30 Thread Toby Hocking
Hi R-core, I have been performance testing R packages for wide-to-tall data reshaping and for the most part I see they differ by constant factors. However in one test, which involves converting into multiple output columns, I see that stats::reshape is in fact quadratic in the number of input col

[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