Re: [Rd] Calling C implementations of rnorm and friends

2016-07-01 Thread Luis Usier
Gabriel, That's exactly what I have been doing, and it works fine. However, I just wanted to *understand* how the random numbers are generated, for no other reason than to satiate my curiosity. The one thing that's not very elegant about this way of doing things is that I have to hard-code specia

Re: [Rd] Calling C implementations of rnorm and friends

2016-07-01 Thread Gabriel Becker
Well, For this particular use case why not just transform the parameters at the R level and then call the existing function? Is there not a closed form mapping? ~G On Jul 1, 2016 2:50 PM, "Joshua Ulrich" wrote: > On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier > wrote: > > Gabriel, > > > > Thanks f

Re: [Rd] Calling C implementations of rnorm and friends

2016-07-01 Thread Joshua Ulrich
On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier wrote: > Gabriel, > > Thanks for that! I guess I really should have figured that one out sooner, > huh? > > I understand why that wouldn't be CRAN-compliant. But then, what *is* the > proper way to do it? Is there any way I can call unexported functions f

Re: [Rd] Calling C implementations of rnorm and friends

2016-07-01 Thread Luis Usier
Gabriel, Thanks for that! I guess I really should have figured that one out sooner, huh? I understand why that wouldn't be CRAN-compliant. But then, what *is* the proper way to do it? Is there any way I can call unexported functions from another package and have it accepted by CRAN? Also, if I i

Re: [Rd] Calling C implementations of rnorm and friends

2016-06-30 Thread Gabriel Becker
Luis, C_rnorm is a symbol but it's not exported. This means that you *can* do this by using stats:::C_rnorm. That said, it's not exported, which means that it's not supported to do this. So your package likely would not be allowed on CRAN, for example. Best, ~G On Jun 30, 2016 2:08 PM, "Luis Us

[Rd] Calling C implementations of rnorm and friends

2016-06-30 Thread Luis Usier
Hi all, Looking at the body for the function rnorm, I see that the body of the function is: .Call(C_rnorm, n, mean, sd) I want to implement functions that generate normal (and other) random variables. Now, I understand that I can perfectly well just call the R wrapper for these functions and