Displaying 8 results from an estimated 8 matches for "c_rnorm".
2016 Jun 30
2
Calling C implementations of rnorm and friends
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 that will be almost indistinguishable for
most purposes, but for whatever reason I wanted to try and call the C...
2016 Jul 01
2
Calling C implementations of rnorm and friends
...erating functions, do
you have any idea of where the source code is in the stats package? As I
said above, I can't seem to find the source code for the functional forms.
Thanks,
Luis
On Thu, Jun 30, 2016 at 10:38 PM, Gabriel Becker <gmbecker at ucdavis.edu>
wrote:
> 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
>...
2016 Jun 30
0
Calling C implementations of rnorm and friends
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...
2016 Jul 01
1
Calling C implementations of rnorm and friends
.../271616
>
> That should give you a few pointers on where/how to look.
>
> > Thanks,
> >
> > Luis
> >
> > On Thu, Jun 30, 2016 at 10:38 PM, Gabriel Becker <gmbecker at ucdavis.edu>
> > wrote:
> >
> >> 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...
2016 Jul 01
0
Calling C implementations of rnorm and friends
...age" from this answer:
http://stackoverflow.com/a/19226817/271616
That should give you a few pointers on where/how to look.
> Thanks,
>
> Luis
>
> On Thu, Jun 30, 2016 at 10:38 PM, Gabriel Becker <gmbecker at ucdavis.edu>
> wrote:
>
>> 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.
>>
&g...
2017 Nov 22
2
function pointers?
...ops to 19.9 MB.
That seemed like a lot of storage for a function's name. Why so much?
My colleagues think the RAM use is high because this is a closure
(hence closureList). I can't even convince myself it actually is a
closure. The R source has
rnorm <- function(n, mean=0, sd=1) .Call(C_rnorm, n, mean, sd)
The storage holding 10000 copies of rnorm, but we really only need 1,
which we can use in the objects.
Thinking of this like C, I am looking to pass in a pointer to the
function. I found my way to the idea of putting a function in an
environment in order to pass it by reference:...
2002 Aug 05
1
constructing a formula
Dear Listers,
I am having trouble figuring out how to build a formula using a variable
list. For example, I have:
a _ data.frame(a=rnorm(1000))
a$b_rnorm(1000)+.5*a$a
a$c_rnorm(1000)+.5*a$b
a$d_rnorm(1000)+.5*a$b+.1*a$a
attach(a)
and I estimate,
lm(d ~ b+c+d)
BUT,
I wish to construct a generalized solution in which,
ListOfVar _ c('b','c','d')
The question is how to leverage ListOfVar into the constuction of the
formula lm(a$d ~ a$b+a$c+a$b)....
2002 Jun 13
1
assign to data.frame
...works, but
is slow and a "merge" is not really required. Rather a rbind will do the
trick. However, there are a number of variables which need to be created in
each data.frame to make the columns of the two data.frames similar.
say,
d1 <- data.frame(ind1=1:10,ind2=letters[1:10],c_rnorm(10))
d2 <- data.frame(ind1=21:30,ind2=letters[11:20],e_rnorm(10))
thus, d1 contains 'c' and d2 contains 'e' - with no overlap in ind1 and ind2.
If I :
d1$e <- rep(NA,10)
d2$c <- rep(NA,10)
I can,
d <- rbind(d1,d2) # which is where I want to go.
However, there are...