[R] library

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Apr 7 18:16:31 CEST 1999


On Wed, 7 Apr 1999, Heberto Ghezzo wrote:

> I also have several packages in my RW0633 in Windoze
> and I would like to keep them in one place when I update the R 
> system.
> Brian say to modify Rprofile to
> ..lib.loc <- c("c:/MyR/library",.Library)
> now Rprofile has a line like
> .lib.loc <- unique(c(unlist(strsplit(getenv("RLIBS"),":")),.Library)

The ":" is a mistake: it should be ";" on Windows (and is on rw0640).

> Sorry to be dense but where should I put the "C:/MyR/library" string?
> inside the c("..",unlist...)

I suggesting putting the line in your .Rprofile, not in Rprofile: the `.'
is crucial. That is have .Rprofile containing

.lib.loc <- c("c:/MyR/library", .Library)

Put the .Rprofile file where R will find it: it tries

HOME
R_HOME
the working directory of the shortcut launching Rgui

in turn.

An easier way if this is your personal machine is to replace the
line in etc/Rprofile by the one I have given above.

> 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.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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