Re: [Rd] Which function can change RNG state?

2015-02-08 Thread Paul Gilbert
On 02/08/2015 09:33 AM, Dirk Eddelbuettel wrote: On 7 February 2015 at 19:52, otoomet wrote: | random numbers. For instance, can I be sure that | set.seed(0); print(runif(1)); print(rnorm(1)) | will always print the same numbers, also in the future version of R? There Yes, pretty much. Th

Re: [Rd] WISH: eval() to preserve the "visibility" (now value is always visible)

2015-02-08 Thread Suharto Anggono Suharto Anggono via R-devel
Sorry to intervene. Argument passed to 'eval' is evaluated first. So, eval(x <- 2) is effectively like { x <- 2; eval(2) } , which is effectively { x <- 2; 2 } . The result is visible. eval(expression(x <- 2)) or eval(quote(x <- 2)) or evalq(x <- 2) gives the same effect as x <- 2 . The result is

[Rd] How to unload R.dll successfully by FreeLibrary

2015-02-08 Thread 暮如雪
hi, I write some code to check the R.dll reference count, and find after LoadLibrary, the R.dll reference count is 3 instead of 1, and after call pfnInit, the reference count is 19, means the R.dll got loaded many times after call pfnInit, even after call LoadLibrary, I assume the reference

Re: [Rd] Testthat and global environments in R packages on CRAN

2015-02-08 Thread Duncan Murdoch
On 08/02/2015 12:16 PM, Måns Magnusson wrote: > Hi! > > The problem is that the test environment inherits from the global > environment. > See https://github.com/hadley/testthat/blob/master/R/test-files.r > > The students labs are simply an R script file. Say that they have an > assignment to cal

Re: [Rd] Testthat and global environments in R packages on CRAN

2015-02-08 Thread Måns Magnusson
Hi! The problem is that the test environment inherits from the global environment. See https://github.com/hadley/testthat/blob/master/R/test-files.r The students labs are simply an R script file. Say that they have an assignment to calculate sqrt(2) and store it in variable a. In the same sessi

Re: [Rd] Testthat and global environments in R packages on CRAN

2015-02-08 Thread Duncan Murdoch
On 08/02/2015 8:22 AM, Måns Magnusson wrote: > Hi! > > Im currently developing an R package to automatically give students > feedback on programming assignments in R. I use the testthat package as an > engine for the unit testing and do a wrapper to make the automatic marking > easy for the studen

Re: [Rd] Which function can change RNG state?

2015-02-08 Thread Gábor Csárdi
On Sat, Feb 7, 2015 at 10:52 PM, otoomet wrote: [...] > random numbers. For instance, can I be sure that > set.seed(0); print(runif(1)); print(rnorm(1)) > will always print the same numbers, also in the future version of R? I don't know if there is intention to keep this reproducible across R

Re: [Rd] Which function can change RNG state?

2015-02-08 Thread Dirk Eddelbuettel
On 7 February 2015 at 19:52, otoomet wrote: | random numbers. For instance, can I be sure that | set.seed(0); print(runif(1)); print(rnorm(1)) | will always print the same numbers, also in the future version of R? There Yes, pretty much. I've been lurking here over fifteen years, and while I

[Rd] Testthat and global environments in R packages on CRAN

2015-02-08 Thread Måns Magnusson
Hi! Im currently developing an R package to automatically give students feedback on programming assignments in R. I use the testthat package as an engine for the unit testing and do a wrapper to make the automatic marking easy for the students. One function (called mark_my_file() ) will mark the

[Rd] Which function can change RNG state?

2015-02-08 Thread otoomet
Today I struggled for hours to understand some unexpected package test results. It turned out that this is because package "parallel", buried deep in my dependencies, calls runif() during it's initialization and in this way changes the random number sequence. This seems to be a part of a more ge