Index of /examples/r/examples/call_c

Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [   ] R_call_C.R 19-Nov-2017 12:31 109 [   ] c_lib.c 19-Nov-2017 12:32 682 [   ] c_lib.o 19-Nov-2017 12:32 7.5K [   ] c_lib.so 19-Nov-2017 12:32 9.7K

RCS Example of R script call C function

Compile C code:
[scc1 ~] R CMD SHLIB  c_lib.c -o c_lib.so

From R script load the dynamic library:
 dyn.load("c_lib.so")
Execute C function :
result <- .Call("cfunction", a=21.7, b=3.14)

For help email

Research Computing Services: help@scc.bu.edu

Note: RCS example programs are provided "as is" without any warranty of any kind. The user assumes the intire risk of quality, performance, and repair of any defect. You are welcome to copy and modify any of the given examples for your own use.