[R] using Rmath in c-functions of R packages

Volodymyr Melnykov volmeln at iastate.edu
Wed Apr 22 04:42:44 CEST 2009


On Tue, 21 Apr 2009 21:49:36 -0400
Duncan Murdoch <murdoch at stats.uwo.ca> wrote:

> On 21/04/2009 9:39 PM, Volodymyr Melnykov wrote:
> > Dear all,
> > 
> > We have created an R package and submitted it to C-RAN. The package
> > includes several C functions that use Rmath library. The package
> > cannot be installed on a computer where -lRmath is not found. We
> > were suggested to do a configure test for this but I am not really
> > sure how to do this and where to read about this. What is a usual
> > way to deal with R packages with c-functions using Rmath?
> 
> I thought that the functions in libRmath are extracted from R, which 
> packages normally link to without any special effort.  You only need 
> Rmath if you are writing a standalone C program, not if you are
> writing an R package.
> 
> Duncan Murdoch
> 

Thank you for your response.
I need c-functions because they are much faster than their R versions.
In my c-functions, I use rnorm(), rgamma() and other functions like
these. I am not sure how I would do this without Rmath.
Thanks,

Volodymyr




More information about the R-help mailing list