[R] interfacing C into R and R packages

Torsten Hothorn Torsten.Hothorn at rzmail.uni-erlangen.de
Tue Nov 4 16:15:45 CET 2003


> Hi,
>
> I would like to interface a C code into R. Is it possible to use in the C code, functions from a R package (for instance, to use pmvnorm within loops in the C code and to call the result in  a R function)?

Probably the most easiest way is copying the C-sources from the original
package (that's what GPL is about). In this special case you need to
(re)-write the R high level function `pmvnorm' in C and call the Fortran77
subroutine `MVTDST' from your C-code. However, keep in mind that `MVTDST'
requires significant time for non-trivial problems and you should make
sure that re-coding the interface in C is worth the effort: Note that you
can call R functions from C anyway (Section 4.9 of `Writing R
Extensions').

Best,

Torsten

>
> Nathalie
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>




More information about the R-help mailing list