[R] C-Code in R (running Windows)

Liaw, Andy andy_liaw at merck.com
Wed Mar 1 15:04:18 CET 2006


The simplest interface is to use .C() in R to call the C function.  The
details (with examples) are in the Writing R Extensions manual that comes
with every version of R.  To compile and load the .dll/.so into R, do:

- Type R CMD SHLIB file1.c file2.c  (at the command prompt, not the R
prompt)
-...start up R in that directory
- Type dyn.load("file1")
- You can now use .C() to call the function

Andy

From: K.A.
> 
> Hello,
> 
> I need to include C (or C++)-Code in R. I'm searching for a 
> tutorial, how to
> do this. It is only a very small algorith (one function). 
> Using google, I
> read somethig about including dll-Files and so on (on windows). 
> 
> Is there no possibility to include a C-File directly?!?
> --
> View this message in context: 
> http://www.nabble.com/C-Code-in-R-%28running-Windows%29-t12051
96.html#a3182004
Sent from the R help forum at Nabble.com.

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list