Re: [R] C code and R

About this list Date view Thread view Subject view Author view Attachment view

From: Duncan Murdoch (murdoch@stats.uwo.ca)
Date: Tue 10 Jul 2001 - 01:17:50 EST


Message-id: <p0ijkt4pbtp440hbd6h5u830b0enqsp06u@4ax.com>

On Mon, 9 Jul 2001 15:50:16 +0200 (MET DST), you wrote in message
<Pine.OSF.3.96.1010709154519.2609J-100000@ija.csic.es>:

>
>A couple of questions on calling C programs
>from R functions:
>
>1. Is there any other guide on this matter in addition to
>Writing R Extensions ?

I don't think there is anything written as a guide, but the source to
lots of packages is available on http://cran.r-project.org. I'd
suggest getting a copy of a small one of those (e.g. Rstreams has C
source, you'll have to look yourself for a small one with Fortran
source), and just modify all the files to suit your needs. If you put
the files in

  ${RHOME}/src/library/yourpackage

and have all the recommended tools and paths set up properly, then

  make pkg-yourpackage

will compile and install the package, so that

  library(yourpackage)

will work in R.

You don't need to put it in a package (you can just compile and link
and use dyn.load() instead of library), but packages are very
convenient because of all the support in the makefiles. I imagine the
makefiles have targets defined for doing this, but I don't think they
are documented anywhere other than in the makefiles themselves, and
those are pretty complicated.

Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 10 Mar 2004 - 08:18:19 EST