[R] library
Guido Masarotto
guido at hal.stat.unipd.it
Wed Apr 7 20:49:00 CEST 1999
On Wed, Apr 07, 1999 at 05:16:31PM +0100, Prof Brian D Ripley wrote:
> On Wed, 7 Apr 1999, Heberto Ghezzo wrote:
>
> > Now I have another question, I would like to implement the
> > 'CutCorner" mothod of random variable generation, I have the C code
> > which calls a function which returns the ordinates of the
> > distribution to be sampled. Since I do not want to generate normals
> > or betas but distributions estimated from lowess or splines the said
> > function have to be written in R. Say it is MyDist()
> > So I need a 'Setup" function that calls the C and set up parameters
> > and passes the name of the R function to compute the distribution and
> > a "Rand" function that just calls a C function that returns the
> > random variate.
> > Now in R I put .C("Setup_system",as.double(par1),MyDist,....
> > How do I pass the name of the R function that evaluates the
> > distribution? i.e. MyDist()
> > and in Setup_system.c() how do I call the R function?
> > S_Call("MyDist",par1,..
>
> Sounds to me as if you need to use call_R and pass the function (not its
> name) as an argument to .C("Setup_system", ....
>
> Now, there are not many examples of call_R/call_S about. Read the
> appropriate section in the Blue Book rather carefully.
Not many, but one small which shows exactly this sort of things
is the R dynload demo. Look to demos/dynload/zero.[cR]
g.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list